aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Rocard <kevinx.rocard@intel.com>2012-12-11 16:19:17 +0100
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:03:31 +0100
commitace81f873b910493ab884dc5a6a38ba6ec3d56d3 (patch)
tree0835bb56ade03f1bd98834f1aaf1abeca3c00459
parent57096bd2de45c840090503d70f40b79565e38881 (diff)
downloadexternal_parameter-framework-ace81f873b910493ab884dc5a6a38ba6ec3d56d3.zip
external_parameter-framework-ace81f873b910493ab884dc5a6a38ba6ec3d56d3.tar.gz
external_parameter-framework-ace81f873b910493ab884dc5a6a38ba6ec3d56d3.tar.bz2
PFW: Do not stop on hard sync errors
BZ: 76263 When synchronization fails, the parameter-framework should log a warning and continue synchronization instead of stopping Change-Id: Ic12d8798ea25584db714ee26e644fac793c28881 Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com> Reviewed-on: http://android.intel.com:8080/81825 Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com> Reviewed-by: Denneulin, Guillaume <guillaume.denneulin@intel.com> Tested-by: Dixon, CharlesX <charlesx.dixon@intel.com> Reviewed-by: cactus <cactus@intel.com> Tested-by: cactus <cactus@intel.com>
-rw-r--r--parameter/AreaConfiguration.cpp12
-rw-r--r--parameter/AreaConfiguration.h2
-rw-r--r--parameter/AutoLog.cpp4
-rw-r--r--parameter/ConfigurableDomain.cpp53
-rw-r--r--parameter/ConfigurableDomain.h4
-rw-r--r--parameter/ConfigurableDomains.cpp39
-rw-r--r--parameter/ConfigurableDomains.h6
-rw-r--r--parameter/ConfigurableElement.cpp2
-rw-r--r--parameter/DomainConfiguration.cpp11
-rw-r--r--parameter/DomainConfiguration.h2
-rw-r--r--parameter/Element.cpp22
-rw-r--r--parameter/Element.h5
-rw-r--r--parameter/HardwareBackSynchronizer.cpp6
-rw-r--r--parameter/HardwareBackSynchronizer.h4
-rw-r--r--parameter/ParameterMgr.cpp70
-rw-r--r--parameter/ParameterMgr.h16
-rw-r--r--parameter/ParameterMgrLogger.cpp7
-rw-r--r--parameter/ParameterMgrLogger.h2
-rw-r--r--parameter/ParameterMgrPlatformConnector.cpp9
-rw-r--r--parameter/ParameterMgrPlatformConnector.h7
-rw-r--r--parameter/SelectionCriteriaDefinition.cpp2
-rw-r--r--parameter/SelectionCriterion.cpp6
-rw-r--r--parameter/SelectionCriterionType.cpp4
-rw-r--r--parameter/SimulatedBackSynchronizer.cpp4
-rw-r--r--parameter/SimulatedBackSynchronizer.h4
-rw-r--r--parameter/SubsystemObject.cpp20
-rw-r--r--parameter/SubsystemObject.h15
-rw-r--r--parameter/SyncerSet.cpp14
-rw-r--r--parameter/SyncerSet.h3
-rw-r--r--parameter/SystemClass.cpp10
-rw-r--r--test/test-platform/TestPlatform.cpp35
-rw-r--r--utility/Android.mk4
-rw-r--r--utility/Utility.cpp46
-rw-r--r--utility/Utility.h38
34 files changed, 317 insertions, 171 deletions
diff --git a/parameter/AreaConfiguration.cpp b/parameter/AreaConfiguration.cpp
index 2523b57..a9519a6 100644
--- a/parameter/AreaConfiguration.cpp
+++ b/parameter/AreaConfiguration.cpp
@@ -49,22 +49,14 @@ void CAreaConfiguration::save(const CParameterBlackboard* pMainBlackboard)
}
// Apply data to current
-bool CAreaConfiguration::restore(CParameterBlackboard* pMainBlackboard, bool bSync, string& strError) const
+bool CAreaConfiguration::restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError) const
{
assert(_bValid);
copyTo(pMainBlackboard, _pConfigurableElement->getOffset());
// Synchronize if required
- if (bSync) {
-
- if (!_pSyncerSet->sync(*pMainBlackboard, false, strError)) {
-
- return false;
- }
- }
-
- return true;
+ return !bSync || _pSyncerSet->sync(*pMainBlackboard, false, plstrError);
}
// Ensure validity
diff --git a/parameter/AreaConfiguration.h b/parameter/AreaConfiguration.h
index b14106c..46d9e3d 100644
--- a/parameter/AreaConfiguration.h
+++ b/parameter/AreaConfiguration.h
@@ -43,7 +43,7 @@ public:
void save(const CParameterBlackboard* pMainBlackboard);
// Apply data to current
- bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, string& strError) const;
+ bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError) const;
// Ensure validity
void validate(const CParameterBlackboard* pMainBlackboard);
diff --git a/parameter/AutoLog.cpp b/parameter/AutoLog.cpp
index eb59b01..5035a8f 100644
--- a/parameter/AutoLog.cpp
+++ b/parameter/AutoLog.cpp
@@ -29,7 +29,7 @@ CAutoLog::CAutoLog(const CElement* pElement, const string& strContext, bool bLog
{
if (_bLogOn) {
// Log
- _pElement->doLog(_strContext + " {");
+ _pElement->doLog(false, _strContext + " {");
// Nest
_pElement->nestLog();
}
@@ -41,6 +41,6 @@ CAutoLog::~CAutoLog()
// Unnest
_pElement->unnestLog();
// Log
- _pElement->doLog( "} " + _strContext);
+ _pElement->doLog(false, "} " + _strContext);
}
}
diff --git a/parameter/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp
index 8c83f48..7d713a1 100644
--- a/parameter/ConfigurableDomain.cpp
+++ b/parameter/ConfigurableDomain.cpp
@@ -90,7 +90,7 @@ void CConfigurableDomain::setSequenceAwareness(bool bSequenceAware)
{
if (_bSequenceAware != bSequenceAware) {
- log("Making domain \"%s\" sequence %s", getName().c_str(), bSequenceAware ? "aware" : "unaware");
+ log_info("Making domain \"%s\" sequence %s", getName().c_str(), bSequenceAware ? "aware" : "unaware");
_bSequenceAware = bSequenceAware;
}
@@ -347,7 +347,7 @@ bool CConfigurableDomain::addConfigurableElement(CConfigurableElement* pConfigur
return false;
}
- log("Adding configurable element \"%s\" into domain \"%s\"", pConfigurableElement->getPath().c_str(), getName().c_str());
+ log_info("Adding configurable element \"%s\" into domain \"%s\"", pConfigurableElement->getPath().c_str(), getName().c_str());
// Do add
doAddConfigurableElement(pConfigurableElement, pMainBlackboard);
@@ -364,7 +364,7 @@ bool CConfigurableDomain::removeConfigurableElement(CConfigurableElement* pConfi
return false;
}
- log("Removing configurable element \"%s\" from domain \"%s\"", pConfigurableElement->getPath().c_str(), getName().c_str());
+ log_info("Removing configurable element \"%s\" from domain \"%s\"", pConfigurableElement->getPath().c_str(), getName().c_str());
// Do remove
doRemoveConfigurableElement(pConfigurableElement, true);
@@ -382,7 +382,7 @@ bool CConfigurableDomain::split(CConfigurableElement* pConfigurableElement, stri
return false;
}
- log("Splitting configurable element \"%s\" domain \"%s\"", pConfigurableElement->getPath().c_str(), getName().c_str());
+ log_info("Splitting configurable element \"%s\" domain \"%s\"", pConfigurableElement->getPath().c_str(), getName().c_str());
// Create sub domain areas for all configurable element's children
uint32_t uiNbConfigurableElementChildren = pConfigurableElement->getNbChildren();
@@ -438,7 +438,7 @@ const CDomainConfiguration* CConfigurableDomain::getPendingConfiguration() const
}
// Configuration application if required
-bool CConfigurableDomain::apply(CParameterBlackboard* pParameterBlackboard, CSyncerSet& syncerSet, bool bForce, string& strError) const
+void CConfigurableDomain::apply(CParameterBlackboard* pParameterBlackboard, CSyncerSet& syncerSet, bool bForce) const
{
if (bForce) {
// Force a configuration restore by forgetting about last applied configuration
@@ -451,13 +451,10 @@ bool CConfigurableDomain::apply(CParameterBlackboard* pParameterBlackboard, CSyn
// Check not the last one before applying
if (!_pLastAppliedConfiguration || _pLastAppliedConfiguration != pApplicableDomainConfiguration) {
- log("Applying configuration \"%s\" from domain \"%s\"", pApplicableDomainConfiguration->getName().c_str(), getName().c_str());
+ log_info("Applying configuration \"%s\" from domain \"%s\"", pApplicableDomainConfiguration->getName().c_str(), getName().c_str());
// Do the restore
- if (!pApplicableDomainConfiguration->restore(pParameterBlackboard, _bSequenceAware, strError)) {
-
- return false;
- }
+ pApplicableDomainConfiguration->restore(pParameterBlackboard, _bSequenceAware, NULL);
// Record last applied configuration
_pLastAppliedConfiguration = pApplicableDomainConfiguration;
@@ -470,8 +467,6 @@ bool CConfigurableDomain::apply(CParameterBlackboard* pParameterBlackboard, CSyn
}
}
}
-
- return true;
}
// Return applicable configuration validity for given configurable element
@@ -509,7 +504,7 @@ bool CConfigurableDomain::createConfiguration(const string& strName, const CPara
return false;
}
- log("Creating domain configuration \"%s\" into domain \"%s\"", strName.c_str(), getName().c_str());
+ log_info("Creating domain configuration \"%s\" into domain \"%s\"", strName.c_str(), getName().c_str());
// Creation
CDomainConfiguration* pDomainConfiguration = new CDomainConfiguration(strName);
@@ -551,7 +546,7 @@ bool CConfigurableDomain::deleteConfiguration(const string& strName, string& str
return false;
}
- log("Deleting configuration \"%s\" from domain \"%s\"", strName.c_str(), getName().c_str());
+ log_info("Deleting configuration \"%s\" from domain \"%s\"", strName.c_str(), getName().c_str());
// Was the last applied?
if (pDomainConfiguration == _pLastAppliedConfiguration) {
@@ -592,33 +587,37 @@ bool CConfigurableDomain::renameConfiguration(const string& strName, const strin
return false;
}
- log("Renaming domain \"%s\"'s configuration \"%s\" to \"%s\"", getName().c_str(), strName.c_str(), strNewName.c_str());
+ log_info("Renaming domain \"%s\"'s configuration \"%s\" to \"%s\"", getName().c_str(), strName.c_str(), strNewName.c_str());
// Rename
return pDomainConfiguration->rename(strNewName, strError);
}
-bool CConfigurableDomain::restoreConfiguration(const string& strName, CParameterBlackboard* pMainBlackboard, bool bAutoSync, string& strError) const
+bool CConfigurableDomain::restoreConfiguration(const string& strName, CParameterBlackboard* pMainBlackboard, bool bAutoSync, list<string>& lstrError) const
{
+ string strError;
+
const CDomainConfiguration* pDomainConfiguration = findConfiguration(strName, strError);
if (!pDomainConfiguration) {
+ lstrError.push_back(strError);
return false;
}
- log("Restoring domain \"%s\"'s configuration \"%s\" to parameter blackboard", getName().c_str(), pDomainConfiguration->getName().c_str());
+ log_info("Restoring domain \"%s\"'s configuration \"%s\" to parameter blackboard", getName().c_str(), pDomainConfiguration->getName().c_str());
// Delegate
- if (!pDomainConfiguration->restore(pMainBlackboard, _bSequenceAware && bAutoSync, strError)) {
-
- return false;
- }
+ bool bSuccess = pDomainConfiguration->restore(pMainBlackboard, bAutoSync && _bSequenceAware, &lstrError);
// Record last applied configuration
_pLastAppliedConfiguration = pDomainConfiguration;
// Synchronize
- return !bAutoSync || _syncerSet.sync(*pMainBlackboard, false, strError);
+ if (bAutoSync && !_bSequenceAware) {
+
+ bSuccess &= _syncerSet.sync(*pMainBlackboard, false, &lstrError);
+ }
+ return bSuccess;
}
bool CConfigurableDomain::saveConfiguration(const string& strName, const CParameterBlackboard* pMainBlackboard, string& strError)
@@ -630,7 +629,7 @@ bool CConfigurableDomain::saveConfiguration(const string& strName, const CParame
return false;
}
- log("Saving domain \"%s\"'s configuration \"%s\" from parameter blackboard", getName().c_str(), pDomainConfiguration->getName().c_str());
+ log_info("Saving domain \"%s\"'s configuration \"%s\" from parameter blackboard", getName().c_str(), pDomainConfiguration->getName().c_str());
// Delegate
pDomainConfiguration->save(pMainBlackboard);
@@ -739,7 +738,7 @@ string CConfigurableDomain::getPendingConfigurationName() const
// Ensure validity on whole domain from main blackboard
void CConfigurableDomain::validate(const CParameterBlackboard* pMainBlackboard)
{
- log("Validating whole domain \"" + getName() + "\" against main blackboard");
+ log_info("Validating whole domain \"" + getName() + "\" against main blackboard");
// Propagate
uint32_t uiNbConfigurations = getNbChildren();
@@ -756,7 +755,7 @@ void CConfigurableDomain::validate(const CParameterBlackboard* pMainBlackboard)
// Ensure validity on areas related to configurable element
void CConfigurableDomain::validateAreas(const CConfigurableElement* pConfigurableElement, const CParameterBlackboard* pMainBlackboard)
{
- log("Validating domain \"" + getName() + "\" against main blackboard for configurable element \"" + pConfigurableElement->getPath() + "\"");
+ log_info("Validating domain \"" + getName() + "\" against main blackboard for configurable element \"" + pConfigurableElement->getPath() + "\"");
// Propagate
uint32_t uiNbConfigurations = getNbChildren();
@@ -798,7 +797,7 @@ void CConfigurableDomain::autoValidateAreas(const CConfigurableElement* pConfigu
return;
}
- log("Auto validating domain \"" + getName() + "\" against configuration \"" + pValidDomainConfiguration->getName() + "\" for configurable element " + pConfigurableElement->getPath());
+ log_info("Auto validating domain \"" + getName() + "\" against configuration \"" + pValidDomainConfiguration->getName() + "\" for configurable element " + pConfigurableElement->getPath());
// Validate all other configurations against found one, if any
uint32_t uiNbConfigurations = getNbChildren();
@@ -910,7 +909,7 @@ void CConfigurableDomain::mergeAlreadyAssociatedDescendantConfigurableElements(C
if (pConfigurablePotentialDescendantElement->isDescendantOf(pNewConfigurableElement)) {
- log("In domain \"%s\", merging descendant configurable element's configurations \"%s\" into its ascendant \"%s\" ones", getName().c_str(), pConfigurablePotentialDescendantElement->getName().c_str(), pNewConfigurableElement->getName().c_str());
+ log_info("In domain \"%s\", merging descendant configurable element's configurations \"%s\" into its ascendant \"%s\" ones", getName().c_str(), pConfigurablePotentialDescendantElement->getName().c_str(), pNewConfigurableElement->getName().c_str());
// Merge configuration data
mergeConfigurations(pNewConfigurableElement, pConfigurablePotentialDescendantElement);
diff --git a/parameter/ConfigurableDomain.h b/parameter/ConfigurableDomain.h
index 29e92cb..46d33d7 100644
--- a/parameter/ConfigurableDomain.h
+++ b/parameter/ConfigurableDomain.h
@@ -51,7 +51,7 @@ public:
bool createConfiguration(const string& strName, const CParameterBlackboard* pMainBlackboard, string& strError);
bool deleteConfiguration(const string& strName, string& strError);
bool renameConfiguration(const string& strName, const string& strNewName, string& strError);
- bool restoreConfiguration(const string& strName, CParameterBlackboard* pMainBlackboard, bool bAutoSync, string& strError) const;
+ bool restoreConfiguration(const string& strName, CParameterBlackboard* pMainBlackboard, bool bAutoSync, list<string>& strError) const;
bool saveConfiguration(const string& strName, const CParameterBlackboard* pMainBlackboard, string& strError);
bool setElementSequence(const string& strConfiguration, const vector<string>& astrNewElementSequence, string& strError);
bool getElementSequence(const string& strConfiguration, string& strResult) const;
@@ -80,7 +80,7 @@ public:
void validate(const CParameterBlackboard* pMainBlackboard);
// Configuration application if required
- bool apply(CParameterBlackboard* pParameterBlackboard, CSyncerSet& syncerSet, bool bForced, string& strError) const;
+ void apply(CParameterBlackboard* pParameterBlackboard, CSyncerSet& syncerSet, bool bForced) const;
// Return applicable configuration validity for given configurable element
bool isApplicableConfigurationValid(const CConfigurableElement* pConfigurableElement) const;
diff --git a/parameter/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp
index 56693ef..a1bfb3c 100644
--- a/parameter/ConfigurableDomains.cpp
+++ b/parameter/ConfigurableDomains.cpp
@@ -22,6 +22,7 @@
* CREATED: 2011-06-01
* UPDATED: 2011-07-27
*/
+#include <cassert>
#include "ConfigurableDomains.h"
#include "ConfigurableDomain.h"
#include "ConfigurableElement.h"
@@ -60,8 +61,9 @@ void CConfigurableDomains::validate(const CParameterBlackboard* pMainBlackboard)
}
// Configuration application if required
-bool CConfigurableDomains::apply(CParameterBlackboard* pParameterBlackboard, bool bForce, string& strError) const
+void CConfigurableDomains::apply(CParameterBlackboard* pParameterBlackboard, bool bForce) const
{
+
CAutoLog autoLog(this, "Applying configurations");
// Syncer set
@@ -77,29 +79,24 @@ bool CConfigurableDomains::apply(CParameterBlackboard* pParameterBlackboard, boo
const CConfigurableDomain* pChildConfigurableDomain = static_cast<const CConfigurableDomain*>(getChild(uiChild));
- if (!pChildConfigurableDomain->getSequenceAwareness() && !pChildConfigurableDomain->apply(pParameterBlackboard, syncerSet, bForce, strError)) {
-
- return false;
+ if (!pChildConfigurableDomain->getSequenceAwareness()) {
+ // Apply sequence unaware domain
+ pChildConfigurableDomain->apply(pParameterBlackboard, syncerSet, bForce);
}
}
- // Synchronize
- if (!syncerSet.sync(*pParameterBlackboard, false, strError)) {
-
- return false;
- }
+ // Synchronize sequence unaware domains
+ syncerSet.sync(*pParameterBlackboard, false, NULL);
// 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;
+ if (pChildConfigurableDomain->getSequenceAwareness()) {
+ // Apply sequence aware domain
+ pChildConfigurableDomain->apply(pParameterBlackboard, syncerSet, bForce);
}
}
-
- return true;
}
// From IXmlSource
@@ -123,7 +120,7 @@ bool CConfigurableDomains::createDomain(const string& strName, string& strError)
return false;
}
- log("Creating configurable domain \"%s\"", strName.c_str());
+ log_info("Creating configurable domain \"%s\"", strName.c_str());
// Creation/Hierarchy
addChild(new CConfigurableDomain(strName));
@@ -140,7 +137,7 @@ bool CConfigurableDomains::deleteDomain(const string& strName, string& strError)
return false;
}
- log("Deleting configurable domain \"%s\"", strName.c_str());
+ log_info("Deleting configurable domain \"%s\"", strName.c_str());
// Hierarchy
removeChild(pConfigurableDomain);
@@ -153,7 +150,7 @@ bool CConfigurableDomains::deleteDomain(const string& strName, string& strError)
void CConfigurableDomains::deleteAllDomains()
{
- log("Deleting all configurable domains");
+ log_info("Deleting all configurable domains");
//remove Children
clean();
@@ -168,7 +165,7 @@ bool CConfigurableDomains::renameDomain(const string& strName, const string& str
return false;
}
- log("Renaming configurable domain \"%s\" to \"%s\"", strName.c_str(), strNewName.c_str());
+ log_info("Renaming configurable domain \"%s\" to \"%s\"", strName.c_str(), strNewName.c_str());
// Rename
return pConfigurableDomain->rename(strNewName, strError);
@@ -377,17 +374,19 @@ void CConfigurableDomains::gatherAllOwnedConfigurableElements(set<const CConfigu
}
// Config restore
-bool CConfigurableDomains::restoreConfiguration(const string& strDomain, const string& strConfiguration, CParameterBlackboard* pMainBlackboard, bool bAutoSync, string& strError) const
+bool CConfigurableDomains::restoreConfiguration(const string& strDomain, const string& strConfiguration, CParameterBlackboard* pMainBlackboard, bool bAutoSync, list<string>& lstrError) const
{
+ string strError;
// Find domain
const CConfigurableDomain* pConfigurableDomain = findConfigurableDomain(strDomain, strError);
if (!pConfigurableDomain) {
+ lstrError.push_back(strError);
return false;
}
// Delegate
- return pConfigurableDomain->restoreConfiguration(strConfiguration, pMainBlackboard, bAutoSync, strError);
+ return pConfigurableDomain->restoreConfiguration(strConfiguration, pMainBlackboard, bAutoSync, lstrError);
}
// Config save
diff --git a/parameter/ConfigurableDomains.h b/parameter/ConfigurableDomains.h
index 6ea37ca..10a00ed 100644
--- a/parameter/ConfigurableDomains.h
+++ b/parameter/ConfigurableDomains.h
@@ -26,6 +26,8 @@
#include "BinarySerializableElement.h"
#include <set>
+#include <list>
+
class CParameterBlackboard;
class CConfigurableElement;
@@ -56,7 +58,7 @@ public:
bool createConfiguration(const string& strDomain, const string& strConfiguration, const CParameterBlackboard* pMainBlackboard, string& strError);
bool deleteConfiguration(const string& strDomain, const string& strConfiguration, string& strError);
bool renameConfiguration(const string& strDomain, const string& strConfigurationName, const string& strNewConfigurationName, string& strError);
- bool restoreConfiguration(const string& strDomain, const string& strConfiguration, CParameterBlackboard* pMainBlackboard, bool bAutoSync, string& strError) const;
+ bool restoreConfiguration(const string& strDomain, const string& strConfiguration, CParameterBlackboard* pMainBlackboard, bool bAutoSync, list<string>& lstrError) const;
bool saveConfiguration(const string& strDomain, const string& strConfiguration, const CParameterBlackboard* pMainBlackboard, string& strError);
bool setElementSequence(const string& strDomain, const string& strConfiguration, const vector<string>& astrNewElementSequence, string& strError);
bool getElementSequence(const string& strDomain, const string& strConfiguration, string& strResult) const;
@@ -81,7 +83,7 @@ public:
void validate(const CParameterBlackboard* pMainBlackboard);
// Configuration application if required
- bool apply(CParameterBlackboard* pParameterBlackboard, bool bForce, string& strError) const;
+ void apply(CParameterBlackboard* pParameterBlackboard, bool bForce) const;
// Class kind
virtual string getKind() const;
diff --git a/parameter/ConfigurableElement.cpp b/parameter/ConfigurableElement.cpp
index cde2ee7..2962295 100644
--- a/parameter/ConfigurableElement.cpp
+++ b/parameter/ConfigurableElement.cpp
@@ -458,7 +458,7 @@ const CSubsystem* CConfigurableElement::getBelongingSubsystem() const
{
const CElement* pParent = getParent();
- // Stop at sytem class
+ // Stop at system class
if (!pParent->getParent()) {
return NULL;
diff --git a/parameter/DomainConfiguration.cpp b/parameter/DomainConfiguration.cpp
index f7243c4..1aa3e0d 100644
--- a/parameter/DomainConfiguration.cpp
+++ b/parameter/DomainConfiguration.cpp
@@ -333,8 +333,10 @@ void CDomainConfiguration::save(const CParameterBlackboard* pMainBlackboard)
}
// Apply data to current
-bool CDomainConfiguration::restore(CParameterBlackboard* pMainBlackboard, bool bSync, string& strError) const
+bool CDomainConfiguration::restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError) const
{
+ bool bSuccess = true;
+
AreaConfigurationListIterator it;
// Just propagate to areas
@@ -342,13 +344,10 @@ bool CDomainConfiguration::restore(CParameterBlackboard* pMainBlackboard, bool b
const CAreaConfiguration* pAreaConfiguration = *it;
- if (!pAreaConfiguration->restore(pMainBlackboard, bSync, strError)) {
-
- return false;
- }
+ bSuccess &= pAreaConfiguration->restore(pMainBlackboard, bSync, plstrError);
}
- return true;
+ return bSuccess;
}
// Ensure validity for configurable element area configuration
diff --git a/parameter/DomainConfiguration.h b/parameter/DomainConfiguration.h
index ab3fb4f..a4e2aad 100644
--- a/parameter/DomainConfiguration.h
+++ b/parameter/DomainConfiguration.h
@@ -61,7 +61,7 @@ public:
// Save data from current
void save(const CParameterBlackboard* pMainBlackboard);
// Apply data to current
- bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, string& strError) const;
+ bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError = NULL) const;
// Ensure validity for configurable element area configuration
void validate(const CConfigurableElement* pConfigurableElement, const CParameterBlackboard* pMainBlackboard);
// Ensure validity of all area configurations
diff --git a/parameter/Element.cpp b/parameter/Element.cpp
index aa4f1b1..de4a8a9 100644
--- a/parameter/Element.cpp
+++ b/parameter/Element.cpp
@@ -41,7 +41,7 @@ CElement::~CElement()
}
// Logging
-void CElement::log(const string& strMessage, ...) const
+void CElement::log_info(const string& strMessage, ...) const
{
char acBuffer[512];
va_list listPointer;
@@ -52,15 +52,29 @@ void CElement::log(const string& strMessage, ...) const
va_end(listPointer);
- doLog(acBuffer);
+ doLog(false, acBuffer);
}
-void CElement::doLog(const string& strLog) const
+void CElement::log_warning(const string& strMessage, ...) const
+{
+ char acBuffer[512];
+ va_list listPointer;
+
+ va_start(listPointer, strMessage);
+
+ vsnprintf(acBuffer, sizeof(acBuffer), strMessage.c_str(), listPointer);
+
+ va_end(listPointer);
+
+ doLog(true, acBuffer);
+}
+
+void CElement::doLog(bool bIsWarning, const string& strLog) const
{
assert(_pParent);
// Propagate till root
- _pParent->doLog(strLog);
+ _pParent->doLog(bIsWarning, strLog);
}
void CElement::nestLog() const
diff --git a/parameter/Element.h b/parameter/Element.h
index 6e5abc9..d870145 100644
--- a/parameter/Element.h
+++ b/parameter/Element.h
@@ -45,7 +45,8 @@ public:
virtual ~CElement();
// Logging
- void log(const string& strMessage, ...) const;
+ void log_info(const string& strMessage, ...) const;
+ void log_warning(const string& strMessage, ...) const;
// Description
void setDescription(const string& strDescription);
@@ -119,7 +120,7 @@ protected:
const CElement* getRoot() const;
private:
// Logging (done by root)
- virtual void doLog(const string& strLog) const;
+ virtual void doLog(bool bIsWarning, const string& strLog) const;
virtual void nestLog() const;
virtual void unnestLog() const;
// Returns Name or Kind if no Name
diff --git a/parameter/HardwareBackSynchronizer.cpp b/parameter/HardwareBackSynchronizer.cpp
index 9a71140..7b09baa 100644
--- a/parameter/HardwareBackSynchronizer.cpp
+++ b/parameter/HardwareBackSynchronizer.cpp
@@ -27,8 +27,8 @@
#define base CBackSynchronizer
-CHardwareBackSynchronizer::CHardwareBackSynchronizer(const CConfigurableElement* pConfigurableElement, string& strError, CParameterBlackboard* pParameterBlackboard)
- : base(pConfigurableElement), _strError(strError), _pParameterBlackboard(pParameterBlackboard)
+CHardwareBackSynchronizer::CHardwareBackSynchronizer(const CConfigurableElement* pConfigurableElement, CParameterBlackboard* pParameterBlackboard)
+ : base(pConfigurableElement), _pParameterBlackboard(pParameterBlackboard)
{
// Fill back syncer set
list<const CConfigurableElement*>::const_iterator it;
@@ -45,5 +45,5 @@ CHardwareBackSynchronizer::CHardwareBackSynchronizer(const CConfigurableElement*
bool CHardwareBackSynchronizer::sync()
{
// Perform back synchronization
- return _backSyncerSet.sync(*_pParameterBlackboard, true, _strError);
+ return _backSyncerSet.sync(*_pParameterBlackboard, true, NULL);
}
diff --git a/parameter/HardwareBackSynchronizer.h b/parameter/HardwareBackSynchronizer.h
index 250ad63..2f0d503 100644
--- a/parameter/HardwareBackSynchronizer.h
+++ b/parameter/HardwareBackSynchronizer.h
@@ -30,7 +30,7 @@
class CHardwareBackSynchronizer : public CBackSynchronizer
{
public:
- CHardwareBackSynchronizer(const CConfigurableElement* pConfigurableElement, string& strError, CParameterBlackboard* pParameterBlackboard);
+ CHardwareBackSynchronizer(const CConfigurableElement* pConfigurableElement, CParameterBlackboard* pParameterBlackboard);
// Back synchronization
virtual bool sync();
@@ -38,8 +38,6 @@ public:
private:
// Back syncer set
CSyncerSet _backSyncerSet;
- // Error
- string& _strError;
// Parameter blackboard
CParameterBlackboard* _pParameterBlackboard;
};
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 4e6e4da..5244199 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -77,6 +77,7 @@
#include "XmlStringDocSink.h"
#include "XmlMemoryDocSink.h"
#include "XmlMemoryDocSource.h"
+#include "Utility.h"
#define base CElement
@@ -256,7 +257,7 @@ void CParameterMgr::setLogger(CParameterMgr::ILogger* pLogger)
}
// Logging
-void CParameterMgr::doLog(const string& strLog) const
+void CParameterMgr::doLog(bool bIsWarning, const string& strLog) const
{
if (_pLogger) {
@@ -272,7 +273,7 @@ void CParameterMgr::doLog(const string& strLog) const
}
// Log
- _pLogger->log(strIndent + strLog);
+ _pLogger->log(bIsWarning, strIndent + strLog);
}
}
@@ -330,7 +331,7 @@ bool CParameterMgr::load(string& strError)
}
// Back synchronization for areas in parameter blackboard not covered by any domain
- CBackSynchronizer* pBackSynchronizer = createBackSynchronizer(strError);
+ CBackSynchronizer* pBackSynchronizer = createBackSynchronizer();
// Back-synchronize
{
@@ -340,7 +341,7 @@ bool CParameterMgr::load(string& strError)
// Get rid of back synchronizer
delete pBackSynchronizer;
- strError = "Main blackboard back synchronization failed: " + strError;
+ strError = "Main blackboard back synchronization failed";
return false;
}
@@ -356,10 +357,7 @@ bool CParameterMgr::load(string& strError)
// Ensure application of currently selected configurations
// Force-apply configurations
- if (!pConfigurableDomains->apply(_pMainParameterBlackboard, true, strError)) {
-
- return false;
- }
+ pConfigurableDomains->apply(_pMainParameterBlackboard, true);
// Start remote processor server if appropriate
return handleRemoteProcessingInterface(strError);
@@ -391,7 +389,7 @@ bool CParameterMgr::loadFrameworkConfiguration(string& strError)
}
// Log tuning availability
- log("Tuning %s", getConstFrameworkConfiguration()->isTuningAllowed() ? "allowed" : "prohibited");
+ log_info("Tuning %s", getConstFrameworkConfiguration()->isTuningAllowed() ? "allowed" : "prohibited");
return true;
}
@@ -489,7 +487,7 @@ bool CParameterMgr::loadSettings(string& strError)
// Auto validation of configurations if no binary settings provided
xmlDomainSerializingContext.setAutoValidationRequired(!pBinarySettingsFileLocation);
- log("Importing configurable domains from file %s %s settings", strXmlConfigurationDomainsFilePath.c_str(), pBinarySettingsFileLocation ? "without" : "with");
+ log_info("Importing configurable domains from file %s %s settings", strXmlConfigurationDomainsFilePath.c_str(), pBinarySettingsFileLocation ? "without" : "with");
// Do parse
if (!xmlParse(xmlDomainSerializingContext, pConfigurableDomains, strXmlConfigurationDomainsFilePath, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) {
@@ -562,7 +560,7 @@ CSelectionCriterion* CParameterMgr::getSelectionCriterion(const string& strName)
}
// Selection criteria changed event
-bool CParameterMgr::applyConfigurations(string& strError)
+void CParameterMgr::applyConfigurations()
{
CAutoLog autoLog(this, "Configuration application request");
@@ -572,22 +570,15 @@ bool CParameterMgr::applyConfigurations(string& strError)
if (!_bTuningModeIsOn) {
// Apply configuration(s)
- if (!getConfigurableDomains()->apply(_pMainParameterBlackboard, false, strError)) {
-
- log("Failed to apply configurations!");
-
- return false;
- }
+ getConfigurableDomains()->apply(_pMainParameterBlackboard, false);
// Reset the modified status of the current criteria to indicate that a new configuration has been applied
getSelectionCriteria()->resetModifiedStatus();
} else {
- log("Warning: Configurations were not applied because the TuningMode is on");
+ log_warning("Configurations were not applied because the TuningMode is on");
}
-
- return true;
}
// Dynamic parameter handling
@@ -975,7 +966,14 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::saveConfigurationCo
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::restoreConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- return restoreConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
+ list<string> lstrResult;
+ if (!restoreConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), lstrResult)) {
+ //Concatenate the error list as the command result
+ CUtility::concatenate(lstrResult, strResult);
+
+ return CCommandHandler::EFailed;
+ }
+ return CCommandHandler::EDone;
}
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
@@ -1337,10 +1335,8 @@ bool CParameterMgr::setTuningMode(bool bOn, string& strError)
// Ensure application of currently selected configurations
// Force-apply configurations
- if (!getConfigurableDomains()->apply(_pMainParameterBlackboard, true, strError)) {
+ getConfigurableDomains()->apply(_pMainParameterBlackboard, true);
- return false;
- }
// Turn auto sync back on
_bAutoSyncOn = true;
}
@@ -1428,8 +1424,16 @@ bool CParameterMgr::sync(string& strError)
CSyncerSet syncerSet;
// ... from system class
getConstSystemClass()->fillSyncerSet(syncerSet);
+
// Sync
- return syncerSet.sync(*_pMainParameterBlackboard, false, strError);
+ list<string> lstrError;
+ if (! syncerSet.sync(*_pMainParameterBlackboard, false, &lstrError)){
+
+ CUtility::concatenate(lstrError, strError);
+ return false;
+ };
+
+ return true;
}
// Content dump
@@ -1505,16 +1509,18 @@ bool CParameterMgr::deleteConfiguration(const string& strDomain, const string& s
return getConfigurableDomains()->deleteConfiguration(strDomain, strConfiguration, strError);
}
-bool CParameterMgr::restoreConfiguration(const string& strDomain, const string& strConfiguration, string& strError)
+bool CParameterMgr::restoreConfiguration(const string& strDomain, const string& strConfiguration, list<string>& lstrError)
{
+ string strError;
// Check tuning mode
if (!checkTuningModeOn(strError)) {
+ lstrError.push_back(strError);
return false;
}
// Delegate to configurable domains
- return getConstConfigurableDomains()->restoreConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, _bAutoSyncOn, strError);
+ return getConstConfigurableDomains()->restoreConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, _bAutoSyncOn, lstrError);
}
bool CParameterMgr::saveConfiguration(const string& strDomain, const string& strConfiguration, string& strError)
@@ -1796,7 +1802,7 @@ bool CParameterMgr::handleRemoteProcessingInterface(string& strError)
// Start server if tuning allowed
if (getConstFrameworkConfiguration()->isTuningAllowed()) {
- log("Loading remote processor library");
+ log_info("Loading remote processor library");
// Load library
void* lib_handle = dlopen("libremote-processor.so", RTLD_NOW);
@@ -1829,7 +1835,7 @@ bool CParameterMgr::handleRemoteProcessingInterface(string& strError)
// Create server
_pRemoteProcessorServer = pfnCreateRemoteProcessorServer(getConstFrameworkConfiguration()->getServerPort(), _pCommandHandler);
- log("Starting remote processor server on port %d", getConstFrameworkConfiguration()->getServerPort());
+ log_info("Starting remote processor server on port %d", getConstFrameworkConfiguration()->getServerPort());
// Start
if (!_pRemoteProcessorServer->start()) {
@@ -1843,15 +1849,15 @@ bool CParameterMgr::handleRemoteProcessingInterface(string& strError)
}
// Back synchronization
-CBackSynchronizer* CParameterMgr::createBackSynchronizer(string& strError) const
+CBackSynchronizer* CParameterMgr::createBackSynchronizer() const
{
#ifdef SIMULATION
// In simulation, back synchronization of the blackboard won't probably work
// We need to ensure though the blackboard is initialized with valid data
- return new CSimulatedBackSynchronizer(getConstSystemClass(), strError, _pMainParameterBlackboard);
+ return new CSimulatedBackSynchronizer(getConstSystemClass(), _pMainParameterBlackboard);
#else
// Real back synchronizer from subsystems
- return new CHardwareBackSynchronizer(getConstSystemClass(), strError, _pMainParameterBlackboard);
+ return new CHardwareBackSynchronizer(getConstSystemClass(), _pMainParameterBlackboard);
#endif
}
diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h
index 78db932..7bbd2a2 100644
--- a/parameter/ParameterMgr.h
+++ b/parameter/ParameterMgr.h
@@ -25,13 +25,14 @@
#pragma once
#include <pthread.h>
+#include <map>
+#include <vector>
+#include <list>
#include "RemoteCommandHandlerTemplate.h"
#include "PathNavigator.h"
#include "SelectionCriterionType.h"
#include "SelectionCriterion.h"
#include "Element.h"
-#include <map>
-#include <vector>
#include "XmlDocSink.h"
#include "XmlDocSource.h"
@@ -89,7 +90,7 @@ public:
class ILogger
{
public:
- virtual void log(const std::string& strLog) = 0;
+ virtual void log(bool bIsWarning, const std::string& strLog) = 0;
};
// Construction
@@ -110,7 +111,7 @@ public:
CSelectionCriterion* getSelectionCriterion(const string& strName);
// Configuration application
- bool applyConfigurations(string& strError);
+ void applyConfigurations();
// Dynamic parameter handling
CParameterHandle* createParameterHandle(const string& strPath, string& strError);
@@ -145,7 +146,7 @@ public:
bool deleteConfiguration(const string& strDomain, const string& strConfiguration, string& strError);
// Save/Restore
- bool restoreConfiguration(const string& strDomain, const string& strConfiguration, string& strError);
+ bool restoreConfiguration(const string& strDomain, const string& strConfiguration, list<string>& strError);
bool saveConfiguration(const string& strDomain, const string& strConfiguration, string& strError);
// Configurable element - domain association
@@ -170,12 +171,13 @@ public:
// CElement
virtual string getKind() const;
+
private:
CParameterMgr(const CParameterMgr&);
CParameterMgr& operator=(const CParameterMgr&);
// Logging (done by root)
- virtual void doLog(const string& strLog) const;
+ virtual void doLog(bool bIsWarning, const string& strLog) const;
virtual void nestLog() const;
virtual void unnestLog() const;
@@ -304,7 +306,7 @@ private:
bool handleRemoteProcessingInterface(string& strError);
// Back synchronization
- CBackSynchronizer* createBackSynchronizer(string& strError) const;
+ CBackSynchronizer* createBackSynchronizer() const;
// Tuning
bool _bTuningModeIsOn;
diff --git a/parameter/ParameterMgrLogger.cpp b/parameter/ParameterMgrLogger.cpp
index 810f7b5..f17bbc0 100644
--- a/parameter/ParameterMgrLogger.cpp
+++ b/parameter/ParameterMgrLogger.cpp
@@ -26,11 +26,12 @@
#include "ParameterMgrPlatformConnector.h"
-CParameterMgrLogger::CParameterMgrLogger(CParameterMgrPlatformConnector *pParameterMgrPlatformConnector) : _pParameterMgrPlatformConnector(pParameterMgrPlatformConnector)
+CParameterMgrLogger::CParameterMgrLogger(CParameterMgrPlatformConnector *pParameterMgrPlatformConnector) :
+ _pParameterMgrPlatformConnector(pParameterMgrPlatformConnector)
{
}
-void CParameterMgrLogger::log(const string &strLog)
+void CParameterMgrLogger::log(bool bIsWarning, const string &strLog)
{
- _pParameterMgrPlatformConnector->doLog(strLog);
+ _pParameterMgrPlatformConnector->doLog(bIsWarning, strLog);
}
diff --git a/parameter/ParameterMgrLogger.h b/parameter/ParameterMgrLogger.h
index 1bbfe9d..07b50c6 100644
--- a/parameter/ParameterMgrLogger.h
+++ b/parameter/ParameterMgrLogger.h
@@ -34,7 +34,7 @@ public:
CParameterMgrLogger(CParameterMgrPlatformConnector* pParameterMgrPlatformConnector);
// Logging
- virtual void log(const string& strLog);
+ virtual void log(bool bIsWarning, const string& strLog);
private:
// Log destination
diff --git a/parameter/ParameterMgrPlatformConnector.cpp b/parameter/ParameterMgrPlatformConnector.cpp
index 456def0..0ef9053 100644
--- a/parameter/ParameterMgrPlatformConnector.cpp
+++ b/parameter/ParameterMgrPlatformConnector.cpp
@@ -64,11 +64,11 @@ ISelectionCriterionInterface* CParameterMgrPlatformConnector::getSelectionCriter
}
// Configuration application
-bool CParameterMgrPlatformConnector::applyConfigurations(string& strError)
+void CParameterMgrPlatformConnector::applyConfigurations()
{
assert(_bStarted);
- return _pParameterMgr->applyConfigurations(strError);
+ _pParameterMgr->applyConfigurations();
}
// Dynamic parameter handling
@@ -93,6 +93,7 @@ bool CParameterMgrPlatformConnector::start(string& strError)
return false;
}
+
// Init flow
if (!_pParameterMgr->init(strError)) {
@@ -111,10 +112,10 @@ bool CParameterMgrPlatformConnector::isStarted() const
}
// Private logging
-void CParameterMgrPlatformConnector::doLog(const string& strLog)
+void CParameterMgrPlatformConnector::doLog(bool bIsWarning, const string& strLog)
{
if (_pLogger) {
- _pLogger->log(strLog);
+ _pLogger->log(bIsWarning, strLog);
}
}
diff --git a/parameter/ParameterMgrPlatformConnector.h b/parameter/ParameterMgrPlatformConnector.h
index 01d8297..64394e4 100644
--- a/parameter/ParameterMgrPlatformConnector.h
+++ b/parameter/ParameterMgrPlatformConnector.h
@@ -21,6 +21,7 @@
*/
#pragma once
+#include <list>
#include "SelectionCriterionTypeInterface.h"
#include "SelectionCriterionInterface.h"
#include "ParameterHandle.h"
@@ -36,7 +37,7 @@ public:
class ILogger
{
public:
- virtual void log(const std::string& strLog) = 0;
+ virtual void log(bool bIsWarning, const std::string& strLog) = 0;
};
// Construction
@@ -61,7 +62,7 @@ public:
bool isStarted() const;
// Configuration application
- bool applyConfigurations(std::string& strError);
+ void applyConfigurations();
// Dynamic parameter handling
// Returned objects are owned by clients
@@ -72,7 +73,7 @@ private:
CParameterMgrPlatformConnector(const CParameterMgrPlatformConnector&);
CParameterMgrPlatformConnector& operator=(const CParameterMgrPlatformConnector&);
// Private logging
- void doLog(const std::string& strLog);
+ void doLog(bool bIsWarning, const std::string& strLog);
// Implementation
CParameterMgr* _pParameterMgr;
diff --git a/parameter/SelectionCriteriaDefinition.cpp b/parameter/SelectionCriteriaDefinition.cpp
index c14ae19..fafb53a 100644
--- a/parameter/SelectionCriteriaDefinition.cpp
+++ b/parameter/SelectionCriteriaDefinition.cpp
@@ -37,7 +37,7 @@ string CSelectionCriteriaDefinition::getKind() const
// Selection Criterion creation
CSelectionCriterion* CSelectionCriteriaDefinition::createSelectionCriterion(const string& strName, const CSelectionCriterionType* pSelectionCriterionType)
{
- log("Creating %s selection criterion \"%s\" - possible states : %s",
+ log_info("Creating %s selection criterion \"%s\" - possible states : %s",
pSelectionCriterionType->isTypeInclusive() ? "inclusive" : "exclusive",
strName.c_str(),
pSelectionCriterionType->listPossibleValues().c_str()
diff --git a/parameter/SelectionCriterion.cpp b/parameter/SelectionCriterion.cpp
index 453f244..77bca4d 100644
--- a/parameter/SelectionCriterion.cpp
+++ b/parameter/SelectionCriterion.cpp
@@ -55,13 +55,13 @@ void CSelectionCriterion::setCriterionState(int iState)
_iState = iState;
- log("Selection criterion changed event: %s", getFormattedDescription(false).c_str());
+ log_info("Selection criterion changed event: %s", getFormattedDescription(false).c_str());
// Check if the previous criterion value has been taken into account (i.e. at least one Configuration was applied
// since the last criterion change)
- if (_uiNbModifications > 0) {
+ if (_uiNbModifications != 0) {
- log("Warning: Selection criterion \"%s\" has been modified %d time(s) without any configuration application", getName().c_str(), _uiNbModifications);
+ log_warning("Selection criterion \"%s\" has been modified %d time(s) without any configuration application", getName().c_str(), _uiNbModifications);
}
// Track the number of modifications for this criterion
diff --git a/parameter/SelectionCriterionType.cpp b/parameter/SelectionCriterionType.cpp
index e2da080..6e5a8cc 100644
--- a/parameter/SelectionCriterionType.cpp
+++ b/parameter/SelectionCriterionType.cpp
@@ -41,7 +41,7 @@ bool CSelectionCriterionType::addValuePair(int iValue, const string& strValue)
// Check 1 bit set only for inclusive types
if (_bInclusive && (!iValue || (iValue & (iValue - 1)))) {
- log("Rejecting value pair association: 0x%X - %s for Selection Criterion Type %s", iValue, strValue.c_str(), getName().c_str());
+ log_warning("Rejecting value pair association: 0x%X - %s for Selection Criterion Type %s", iValue, strValue.c_str(), getName().c_str());
return false;
}
@@ -49,7 +49,7 @@ bool CSelectionCriterionType::addValuePair(int iValue, const string& strValue)
// Check already inserted
if (_numToLitMap.find(strValue) != _numToLitMap.end()) {
- log("Rejecting value pair association (literal already present): 0x%X - %s for Selection Criterion Type %s", iValue, strValue.c_str(), getName().c_str());
+ log_warning("Rejecting value pair association (literal already present): 0x%X - %s for Selection Criterion Type %s", iValue, strValue.c_str(), getName().c_str());
return false;
}
diff --git a/parameter/SimulatedBackSynchronizer.cpp b/parameter/SimulatedBackSynchronizer.cpp
index 122afb4..bb0d0fb 100644
--- a/parameter/SimulatedBackSynchronizer.cpp
+++ b/parameter/SimulatedBackSynchronizer.cpp
@@ -27,8 +27,8 @@
#define base CBackSynchronizer
-CSimulatedBackSynchronizer::CSimulatedBackSynchronizer(const CConfigurableElement* pConfigurableElement, string& strError, CParameterBlackboard* pParameterBlackboard)
- : base(pConfigurableElement), _parameterAccessContext(strError)
+CSimulatedBackSynchronizer::CSimulatedBackSynchronizer(const CConfigurableElement* pConfigurableElement, CParameterBlackboard* pParameterBlackboard)
+ : base(pConfigurableElement), _parameterAccessContext(_strError)
{
_parameterAccessContext.setParameterBlackboard(pParameterBlackboard);
}
diff --git a/parameter/SimulatedBackSynchronizer.h b/parameter/SimulatedBackSynchronizer.h
index 91414cb..2500be2 100644
--- a/parameter/SimulatedBackSynchronizer.h
+++ b/parameter/SimulatedBackSynchronizer.h
@@ -32,11 +32,13 @@ class CParameterBlackboard;
class CSimulatedBackSynchronizer : public CBackSynchronizer
{
public:
- CSimulatedBackSynchronizer(const CConfigurableElement* pConfigurableElement, string& strError, CParameterBlackboard* pParameterBlackboard);
+ CSimulatedBackSynchronizer(const CConfigurableElement* pConfigurableElement, CParameterBlackboard* pParameterBlackboard);
// Back synchronization
virtual bool sync();
private:
+ // Fake error for parameter context creation
+ string _strError;
// Parameter context
CParameterAccessContext _parameterAccessContext;
};
diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp
index f98509e..8c5c5e4 100644
--- a/parameter/SubsystemObject.cpp
+++ b/parameter/SubsystemObject.cpp
@@ -93,6 +93,7 @@ bool CSubsystemObject::sync(CParameterBlackboard& parameterBlackboard, bool bBac
if (!accessHW(true, strError)) {
strError = "Unable to back synchronize configurable element " + _pInstanceConfigurableElement->getPath() + ": " + strError;
+ log_warning(strError);
return false;
}
@@ -103,6 +104,7 @@ bool CSubsystemObject::sync(CParameterBlackboard& parameterBlackboard, bool bBac
if (!accessHW(false, strError)) {
strError = "Unable to synchronize configurable element " + _pInstanceConfigurableElement->getPath() + ": " + strError;
+ log_warning(strError);
return false;
}
@@ -158,7 +160,7 @@ void CSubsystemObject::blackboardWrite(const void* pvData, uint32_t uiSize)
}
// Logging
-void CSubsystemObject::log(const string& strMessage, ...) const
+void CSubsystemObject::log_info(const string& strMessage, ...) const
{
char acBuffer[512];
va_list listPointer;
@@ -169,7 +171,21 @@ void CSubsystemObject::log(const string& strMessage, ...) const
va_end(listPointer);
- _pInstanceConfigurableElement->log(acBuffer);
+ _pInstanceConfigurableElement->log_info(acBuffer);
+}
+
+void CSubsystemObject::log_warning(const string& strMessage, ...) const
+{
+ char acBuffer[512];
+ va_list listPointer;
+
+ va_start(listPointer, strMessage);
+
+ vsnprintf(acBuffer, sizeof(acBuffer), strMessage.c_str(), listPointer);
+
+ va_end(listPointer);
+
+ _pInstanceConfigurableElement->log_warning(acBuffer);
}
// Amendment
diff --git a/parameter/SubsystemObject.h b/parameter/SubsystemObject.h
index 3b6f31a..6cbfd76 100644
--- a/parameter/SubsystemObject.h
+++ b/parameter/SubsystemObject.h
@@ -30,15 +30,12 @@
class CInstanceConfigurableElement;
class CMappingContext;
-class CSubsystemObject : public ISyncer
+class CSubsystemObject : private ISyncer
{
public:
CSubsystemObject(CInstanceConfigurableElement* pInstanceConfigurableElement);
virtual ~CSubsystemObject();
- // from ISyncer
- virtual bool sync(CParameterBlackboard& parameterBlackboard, bool bBack, string& strError);
-
protected:
// Blackboard data location
uint8_t* getBlackboardLocation() const;
@@ -57,15 +54,21 @@ protected:
void blackboardRead(void* pvData, uint32_t uiSize);
void blackboardWrite(const void* pvData, uint32_t uiSize);
// Logging
- void log(const string& strMessage, ...) const;
+ void log_info(const string& strMessage, ...) const;
+ void log_warning(const string& strMessage, ...) const;
// Mapping formatting
static string formatMappingValue(const string& strMappingValue, uint32_t uiFirstAmendKey, uint32_t uiNbAmendKeys, const CMappingContext& context);
// Configurable element retrieval
const CInstanceConfigurableElement* getConfigurableElement() const;
private:
+ // from ISyncer
+ virtual bool sync(CParameterBlackboard& parameterBlackboard, bool bBack, string& strError);
+
CSubsystemObject(const CSubsystemObject&);
- CSubsystemObject& operator=(const CSubsystemObject&);
+
+ // Define affection operator
+ const CSubsystemObject& operator=(const CSubsystemObject&);
// Instance element to sync from/to
CInstanceConfigurableElement* _pInstanceConfigurableElement;
diff --git a/parameter/SyncerSet.cpp b/parameter/SyncerSet.cpp
index 27d2c87..d427e2f 100644
--- a/parameter/SyncerSet.cpp
+++ b/parameter/SyncerSet.cpp
@@ -51,8 +51,12 @@ void CSyncerSet::clear()
_syncerSet.clear();
}
-bool CSyncerSet::sync(CParameterBlackboard& parameterBlackboard, bool bBack, string& strError) const
+bool CSyncerSet::sync(CParameterBlackboard& parameterBlackboard, bool bBack, list<string>* plstrError) const
{
+ bool bSuccess = true;
+
+ string strError;
+
// Propagate
SyncerSetConstIterator it;
@@ -62,8 +66,12 @@ bool CSyncerSet::sync(CParameterBlackboard& parameterBlackboard, bool bBack, str
if (!pSyncer->sync(parameterBlackboard, bBack, strError)) {
- return false;
+ if (plstrError) {
+
+ plstrError->push_back(strError);
+ }
+ bSuccess = false;
}
}
- return true;
+ return bSuccess;
}
diff --git a/parameter/SyncerSet.h b/parameter/SyncerSet.h
index fe393bc..aae4249 100644
--- a/parameter/SyncerSet.h
+++ b/parameter/SyncerSet.h
@@ -26,6 +26,7 @@
#include <set>
#include <string>
+#include <list>
using namespace std;
@@ -46,7 +47,7 @@ public:
void clear();
// Sync
- bool sync(CParameterBlackboard& parameterBlackboard, bool bBack, string& strError) const;
+ bool sync(CParameterBlackboard& parameterBlackboard, bool bBack, list<string>* plstrError) const;
private:
set<ISyncer*> _syncerSet;
diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp
index 8d6b334..dbce345 100644
--- a/parameter/SystemClass.cpp
+++ b/parameter/SystemClass.cpp
@@ -73,7 +73,7 @@ string CSystemClass::getKind() const
bool CSystemClass::loadSubsystems(string& strError, const CSubsystemPlugins* pSubsystemPlugins)
{
- CAutoLog autoLlog(this, "Loading subsystem plugins");
+ CAutoLog autoLlog_info(this, "Loading subsystem plugins");
// Plugin list
list<string> lstrPluginFiles;
@@ -103,7 +103,7 @@ bool CSystemClass::loadSubsystems(string& strError, const CSubsystemPlugins* pSu
if (!lstrPluginFiles.size()) {
// No plugin found?
- log("No subsystem plugin found");
+ log_warning("No subsystem plugin found");
// Don't bail out now that we have virtual subsystems
}
@@ -130,7 +130,7 @@ bool CSystemClass::loadSubsystems(string& strError, const CSubsystemPlugins* pSu
return false;
}
}
- log("All subsystem plugins successfully loaded");
+ log_info("All subsystem plugins successfully loaded");
// Add virtual subsystem builder
_pSubsystemLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CVirtualSubsystem>("Virtual"));
@@ -171,7 +171,7 @@ bool CSystemClass::loadPlugins(list<string>& lstrPluginFiles, string& strError)
string strPluginFileName = *it;
- log("Attempting to load subsystem plugin path \"%s\"", strPluginFileName.c_str());
+ log_info("Attempting to load subsystem plugin path \"%s\"", strPluginFileName.c_str());
// Load attempt
void* lib_handle = dlopen(strPluginFileName.c_str(), RTLD_LAZY);
@@ -179,7 +179,7 @@ bool CSystemClass::loadPlugins(list<string>& lstrPluginFiles, string& strError)
if (!lib_handle) {
// Failed
- log("Plugin load failed: %s, proceeding on with remaining ones", dlerror());
+ log_warning("Plugin load failed: %s, proceeding on with remaining ones", dlerror());
// Next plugin
++it;
diff --git a/test/test-platform/TestPlatform.cpp b/test/test-platform/TestPlatform.cpp
index af741ed..60ee644 100644
--- a/test/test-platform/TestPlatform.cpp
+++ b/test/test-platform/TestPlatform.cpp
@@ -27,19 +27,25 @@
#include <stdlib.h>
#include <sstream>
#include <assert.h>
+#include <errno.h>
#include "TestPlatform.h"
#include "ParameterMgrPlatformConnector.h"
#include "RemoteProcessorServer.h"
-#include <errno.h>
class CParameterMgrPlatformConnectorLogger : public CParameterMgrPlatformConnector::ILogger
{
public:
CParameterMgrPlatformConnectorLogger() {}
- virtual void log(const string& strLog) {
+ virtual void log(bool bIsWarning, const string& strLog) {
+
+ if (bIsWarning) {
- cout << strLog << endl;
+ cerr << strLog << endl;
+ } else {
+
+ cout << strLog << endl;
+ }
}
};
@@ -92,29 +98,34 @@ bool CTestPlatform::load(std::string& strError)
/// Selection Criterion
CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::createExclusiveSelectionCriterionFromStateListCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- return createExclusiveSelectionCriterionFromStateList(remoteCommand.getArgument(0), remoteCommand, strResult) ? CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
+ return createExclusiveSelectionCriterionFromStateList(remoteCommand.getArgument(0), remoteCommand, strResult) ?
+ CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
}
CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::createInclusiveSelectionCriterionFromStateListCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- return createInclusiveSelectionCriterionFromStateList(remoteCommand.getArgument(0), remoteCommand, strResult) ? CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
+ return createInclusiveSelectionCriterionFromStateList(remoteCommand.getArgument(0), remoteCommand, strResult) ?
+ CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
}
CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::createExclusiveSelectionCriterionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- return createExclusiveSelectionCriterion(remoteCommand.getArgument(0), strtoul(remoteCommand.getArgument(1).c_str(), NULL, 0), strResult) ? CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
+ return createExclusiveSelectionCriterion(remoteCommand.getArgument(0), strtoul(remoteCommand.getArgument(1).c_str(), NULL, 0), strResult) ?
+ CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
}
CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::createInclusiveSelectionCriterionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- return createInclusiveSelectionCriterion(remoteCommand.getArgument(0), strtoul(remoteCommand.getArgument(1).c_str(), NULL, 0), strResult) ? CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
+ return createInclusiveSelectionCriterion(remoteCommand.getArgument(0), strtoul(remoteCommand.getArgument(1).c_str(), NULL, 0), strResult) ?
+ CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
}
-
CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::startParameterMgrCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
- return _pParameterMgrPlatformConnector->start(strResult) ? CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
+
+ return _pParameterMgrPlatformConnector->start(strResult) ?
+ CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
}
CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::setCriterionStateCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
@@ -147,7 +158,11 @@ CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::setCriterionStateCo
CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::applyConfigurationsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
- return _pParameterMgrPlatformConnector->applyConfigurations(strResult) ? CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
+ (void)strResult;
+
+ _pParameterMgrPlatformConnector->applyConfigurations();
+
+ return CTestPlatform::CCommandHandler::EDone;
}
//////////////// Remote command handlers
diff --git a/utility/Android.mk b/utility/Android.mk
index f6af488..acdf6a1 100644
--- a/utility/Android.mk
+++ b/utility/Android.mk
@@ -3,7 +3,9 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= Tokenizer.cpp
+LOCAL_SRC_FILES:= \
+ Tokenizer.cpp \
+ Utility.cpp
LOCAL_MODULE:= libutility
diff --git a/utility/Utility.cpp b/utility/Utility.cpp
new file mode 100644
index 0000000..afedc07
--- /dev/null
+++ b/utility/Utility.cpp
@@ -0,0 +1,46 @@
+/*
+ * INTEL CONFIDENTIAL
+ * Copyright © 2011 Intel
+ * Corporation All Rights Reserved.
+ *
+ * The source code contained or described herein and all documents related to
+ * the source code ("Material") are owned by Intel Corporation or its suppliers
+ * or licensors. Title to the Material remains with Intel Corporation or its
+ * suppliers and licensors. The Material contains trade secrets and proprietary
+ * and confidential information of Intel or its suppliers and licensors. The
+ * Material is protected by worldwide copyright and trade secret laws and
+ * treaty provisions. No part of the Material may be used, copied, reproduced,
+ * modified, published, uploaded, posted, transmitted, distributed, or
+ * disclosed in any way without Intel’s prior express written permission.
+ *
+ * No license under any patent, copyright, trade secret or other intellectual
+ * property right is granted to or conferred upon you by disclosure or delivery
+ * of the Materials, either expressly, by implication, inducement, estoppel or
+ * otherwise. Any license under such intellectual property rights must be
+ * express and approved by Intel in writing.
+ *
+ * CREATED: 2012-12-17
+ */
+
+#include "Utility.h"
+
+// Concatenate string list
+void CUtility::concatenate(const std::list<std::string>& lstr, std::string& strOutput, const std::string& strSeparator)
+{
+ bool bStart = true;
+
+ std::list<std::string>::const_iterator iterator(lstr.begin());
+ std::list<std::string>::const_iterator end(lstr.end());
+
+ while (iterator != end) {
+
+ if (bStart) {
+ // Do not add a separator before first element
+ bStart = false;
+ } else {
+ // Add the separator bettween each element
+ strOutput += strSeparator;
+ }
+ strOutput += *iterator++;
+ }
+}
diff --git a/utility/Utility.h b/utility/Utility.h
new file mode 100644
index 0000000..7c395c0
--- /dev/null
+++ b/utility/Utility.h
@@ -0,0 +1,38 @@
+/*
+ * INTEL CONFIDENTIAL
+ * Copyright © 2011 Intel
+ * Corporation All Rights Reserved.
+ *
+ * The source code contained or described herein and all documents related to
+ * the source code ("Material") are owned by Intel Corporation or its suppliers
+ * or licensors. Title to the Material remains with Intel Corporation or its
+ * suppliers and licensors. The Material contains trade secrets and proprietary
+ * and confidential information of Intel or its suppliers and licensors. The
+ * Material is protected by worldwide copyright and trade secret laws and
+ * treaty provisions. No part of the Material may be used, copied, reproduced,
+ * modified, published, uploaded, posted, transmitted, distributed, or
+ * disclosed in any way without Intel’s prior express written permission.
+ *
+ * No license under any patent, copyright, trade secret or other intellectual
+ * property right is granted to or conferred upon you by disclosure or delivery
+ * of the Materials, either expressly, by implication, inducement, estoppel or
+ * otherwise. Any license under such intellectual property rights must be
+ * express and approved by Intel in writing.
+ *
+ * CREATED: 2012-12-17
+ */
+
+#ifndef UTILITY_H
+#define UTILITY_H
+
+#include <string>
+#include <list>
+
+class CUtility
+{
+public:
+ // Concatenate string list
+ static void concatenate(const std::list<std::string>& lstr, std::string& strOutput, const std::string& separator = "\n");
+};
+
+#endif // UTILITY_H