summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Gaffie <francois.gaffie@intel.com>2014-04-07 13:46:05 +0200
committerMattijs Korpershoek <mattijsx.korpershoek@intel.com>2014-06-24 11:51:35 +0200
commit8ab7293fc32d078f558985b938fa5c71c2b0404b (patch)
tree4123046de6b599d346e339d5c6126744d63a499e
parent01c7495e66caea59165316bc025a69cce1383311 (diff)
downloadexternal_parameter-framework-8ab7293fc32d078f558985b938fa5c71c2b0404b.zip
external_parameter-framework-8ab7293fc32d078f558985b938fa5c71c2b0404b.tar.gz
external_parameter-framework-8ab7293fc32d078f558985b938fa5c71c2b0404b.tar.bz2
Restore autosync of string parameter
BZ: 183857 Sync for String parameter accessed from parameter handle API does not work. This patch allows synchronisation for string parameter accessed from parameter handle APIs. Change-Id: If738402f4c0fcb0bb51bd2515e46f3ac36a361dd Signed-off-by: Francois Gaffie <francois.gaffie@intel.com> Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
-rw-r--r--parameter/ArrayParameter.cpp34
-rw-r--r--parameter/BaseParameter.cpp5
-rw-r--r--parameter/BitParameter.cpp9
-rw-r--r--parameter/InstanceConfigurableElement.cpp8
-rw-r--r--parameter/InstanceConfigurableElement.h12
-rw-r--r--parameter/Parameter.cpp36
-rw-r--r--parameter/ParameterAccessContext.cpp6
7 files changed, 67 insertions, 43 deletions
diff --git a/parameter/ArrayParameter.cpp b/parameter/ArrayParameter.cpp
index dedb5da..47000a7 100644
--- a/parameter/ArrayParameter.cpp
+++ b/parameter/ArrayParameter.cpp
@@ -119,11 +119,10 @@ bool CArrayParameter::accessValue(CPathNavigator& pathNavigator, string& strValu
}
// Synchronize
- if (parameterAccessContext.getAutoSync() && !sync(parameterAccessContext)) {
+ if (!sync(parameterAccessContext)) {
// Append parameter path to error
parameterAccessContext.appendToError(" " + getPath());
-
return false;
}
} else {
@@ -326,28 +325,31 @@ void CArrayParameter::getValues(uint32_t uiBaseOffset, string& strValues, CParam
template <typename type>
bool CArrayParameter::accessValues(vector<type>& values, bool bSet, CParameterAccessContext& parameterAccessContext) const
{
- bool bSuccess;
-
if (bSet) {
- if (setValues(values, parameterAccessContext)) {
+ // Set Value
+ if (!setValues(values, parameterAccessContext)) {
- // Synchronize
- bSuccess = sync(parameterAccessContext);
- } else {
+ // Append parameter path to error
+ parameterAccessContext.appendToError(" " + getPath());
+ return false;
+ }
+ if (!sync(parameterAccessContext)) {
- bSuccess = false;
+ // Append parameter path to error
+ parameterAccessContext.appendToError(" " + getPath());
+ return false;
}
} else {
+ // Get Value
+ if (!getValues(values, parameterAccessContext)) {
- bSuccess = getValues(values, parameterAccessContext);
- }
- if (!bSuccess) {
-
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ // Append parameter path to error
+ parameterAccessContext.appendToError(" " + getPath());
+ return false;
+ }
}
- return bSuccess;
+ return true;
}
template <typename type>
diff --git a/parameter/BaseParameter.cpp b/parameter/BaseParameter.cpp
index 65fa8bc..3c49471 100644
--- a/parameter/BaseParameter.cpp
+++ b/parameter/BaseParameter.cpp
@@ -51,7 +51,6 @@ bool CBaseParameter::serializeXmlSettings(CXmlElement& xmlConfigurationSettingsE
// Append parameter path to error
configurationAccessContext.appendToError(" " + getPath());
-
return false;
}
} else {
@@ -180,15 +179,13 @@ bool CBaseParameter::accessAsString(string& strValue, bool bSet, CParameterAcces
// Append parameter path to error
parameterAccessContext.appendToError(" " + getPath());
-
return false;
}
// Synchronize
- if (parameterAccessContext.getAutoSync() && !sync(parameterAccessContext)) {
+ if (!sync(parameterAccessContext)) {
// Append parameter path to error
parameterAccessContext.appendToError(" " + getPath());
-
return false;
}
diff --git a/parameter/BitParameter.cpp b/parameter/BitParameter.cpp
index aed9459..2077cde 100644
--- a/parameter/BitParameter.cpp
+++ b/parameter/BitParameter.cpp
@@ -113,12 +113,17 @@ bool CBitParameter::accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAcce
if (bSet) {
- // Set and sync
- if (!doSet(uiValue, uiOffset, parameterAccessContext) || !sync(parameterAccessContext)) {
+ // Set Value
+ if (!doSet(uiValue, uiOffset, parameterAccessContext)) {
// Append parameter path to error
parameterAccessContext.appendToError(" " + getPath());
+ return false;
+ }
+ // Synchronize
+ if (!sync(parameterAccessContext)) {
+ parameterAccessContext.appendToError(" " + getPath());
return false;
}
} else {
diff --git a/parameter/InstanceConfigurableElement.cpp b/parameter/InstanceConfigurableElement.cpp
index d0e1971..003a606 100644
--- a/parameter/InstanceConfigurableElement.cpp
+++ b/parameter/InstanceConfigurableElement.cpp
@@ -175,9 +175,14 @@ void CInstanceConfigurableElement::fillSyncerSetFromDescendant(CSyncerSet& synce
}
}
-// Sync
bool CInstanceConfigurableElement::sync(CParameterAccessContext& parameterAccessContext) const
{
+ if (!parameterAccessContext.getAutoSync()) {
+
+ // AutoSync is disabled, do not perform the sync.
+ // This is not an error, but the expected behavior so return true anyway.
+ return true;
+ }
ISyncer* pSyncer = getSyncer();
if (!pSyncer) {
@@ -211,4 +216,3 @@ bool CInstanceConfigurableElement::checkPathExhausted(CPathNavigator& pathNaviga
}
return true;
}
-
diff --git a/parameter/InstanceConfigurableElement.h b/parameter/InstanceConfigurableElement.h
index 78b348c..39a0d94 100644
--- a/parameter/InstanceConfigurableElement.h
+++ b/parameter/InstanceConfigurableElement.h
@@ -104,8 +104,18 @@ protected:
virtual ISyncer* getSyncer() const;
// Syncer set (descendant)
virtual void fillSyncerSetFromDescendant(CSyncerSet& syncerSet) const;
- // Sync
+
+ /**
+ * Performs the sync if the AutoSync is enabled.
+ * If AutoSync is disabled, any call to sync will returns true, even if synchronization has not
+ * been done. It will happen when the AutoSync will be switched back on.
+ *
+ * @param[in:out] parameterAccessContext Parameter access context object
+ *
+ * @return true if the synchronization succeded or if the AutoSync is off, false otherwise.
+ */
bool sync(CParameterAccessContext& parameterAccessContext) const;
+
// Check parameter access path well formed for leaf elements
static bool checkPathExhausted(CPathNavigator& pathNavigator, CErrorContext& errorContext);
private:
diff --git a/parameter/Parameter.cpp b/parameter/Parameter.cpp
index 631710d..75433dd 100644
--- a/parameter/Parameter.cpp
+++ b/parameter/Parameter.cpp
@@ -122,30 +122,36 @@ bool CParameter::accessAsDouble(double& dValue, bool bSet, CParameterAccessConte
// Generic Access
template <typename type>
-bool CParameter::doAccess(type& value, bool bSet, CParameterAccessContext& parameterAccessContext) const
+bool CParameter::doAccess(type& value, bool bSet,
+ CParameterAccessContext& parameterAccessContext) const
{
- bool bSuccess;
-
if (bSet) {
+ // set value
+ if (!doSet(value, getOffset() - parameterAccessContext.getBaseOffset(),
+ parameterAccessContext)) {
- if (doSet(value, getOffset() - parameterAccessContext.getBaseOffset(), parameterAccessContext)) {
+ // Append parameter path to error
+ parameterAccessContext.appendToError(" " + getPath());
+ return false;
- // Synchronize
- bSuccess = sync(parameterAccessContext);
- } else {
+ }
+ // Synchronize
+ if (!sync(parameterAccessContext)){
- bSuccess = false;
+ parameterAccessContext.appendToError(" " + getPath());
+ return false;
}
} else {
+ // get value
+ if (!doGet(value, getOffset() - parameterAccessContext.getBaseOffset(),
+ parameterAccessContext)) {
- bSuccess = doGet(value, getOffset() - parameterAccessContext.getBaseOffset(), parameterAccessContext);
- }
- if (!bSuccess) {
-
- // Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath());
+ // Append parameter path to error
+ parameterAccessContext.appendToError(" " + getPath());
+ return false;
+ }
}
- return bSuccess;
+ return true;
}
template <typename type>
diff --git a/parameter/ParameterAccessContext.cpp b/parameter/ParameterAccessContext.cpp
index b48e7c5..579f6bf 100644
--- a/parameter/ParameterAccessContext.cpp
+++ b/parameter/ParameterAccessContext.cpp
@@ -38,7 +38,7 @@ CParameterAccessContext::CParameterAccessContext(string& strError,
uint32_t uiBaseOffset)
: base(strError), _pParameterBlackboard(pParameterBlackboard),
_bValueSpaceIsRaw(bValueSpaceIsRaw), _bOutputRawFormatIsHex(bOutputRawFormatIsHex),
- _bBigEndianSubsystem(false), _bAutoSync(false), _uiBaseOffset(uiBaseOffset)
+ _bBigEndianSubsystem(false), _bAutoSync(true), _uiBaseOffset(uiBaseOffset)
{
}
@@ -47,14 +47,14 @@ CParameterAccessContext::CParameterAccessContext(string& strError,
CParameterBlackboard* pParameterBlackboard,
uint32_t uiBaseOffset)
: base(strError), _pParameterBlackboard(pParameterBlackboard), _bValueSpaceIsRaw(false),
- _bOutputRawFormatIsHex(false), _bBigEndianSubsystem(bBigEndianSubsystem), _bAutoSync(false),
+ _bOutputRawFormatIsHex(false), _bBigEndianSubsystem(bBigEndianSubsystem), _bAutoSync(true),
_uiBaseOffset(uiBaseOffset)
{
}
CParameterAccessContext::CParameterAccessContext(string& strError)
: base(strError), _pParameterBlackboard(NULL), _bValueSpaceIsRaw(false),
- _bOutputRawFormatIsHex(false), _bBigEndianSubsystem(false), _bAutoSync(false), _uiBaseOffset(0)
+ _bOutputRawFormatIsHex(false), _bBigEndianSubsystem(false), _bAutoSync(true), _uiBaseOffset(0)
{
}