From 2ecf900ad8c30ce9f8e81f57977a1a80a6f6d8af Mon Sep 17 00:00:00 2001 From: Patrick Benavoli Date: Wed, 31 Aug 2011 11:23:24 +0200 Subject: Parameter Framework: Parameter property display BZ: 7137 Added showProperties remote command Changed EQU to MONO_EQ for CAPTURE paths in LPE Subsystem structure definition Had to create a generic class for Parameter and BitParameter classes Change-Id: If6ab97ff002d8ba81df5a4a60bc3eb07dbe14e5e Orig-Change-Id: I425f81cd414b1c721f5c11169e9a489f5c638ab9 Signed-off-by: Patrick Benavoli Reviewed-on: http://android.intel.com:8080/16879 Reviewed-by: Mahe, Erwan Tested-by: Barthes, FabienX Reviewed-by: buildbot Tested-by: buildbot --- parameter/Parameter.cpp | 103 +++--------------------------------------------- 1 file changed, 5 insertions(+), 98 deletions(-) (limited to 'parameter/Parameter.cpp') diff --git a/parameter/Parameter.cpp b/parameter/Parameter.cpp index 57a78b1..70865ad 100644 --- a/parameter/Parameter.cpp +++ b/parameter/Parameter.cpp @@ -34,16 +34,12 @@ #include "ConfigurationAccessContext.h" #include "ParameterBlackboard.h" -#define base CInstanceConfigurableElement +#define base CBaseParameter CParameter::CParameter(const string& strName, const CTypeElement* pTypeElement) : base(strName, pTypeElement) { } -CParameter::~CParameter() -{ -} - CInstanceConfigurableElement::Type CParameter::getType() const { return EParameter; @@ -55,32 +51,11 @@ bool CParameter::serializeXmlSettings(CXmlElement& xmlConfigurationSettingsEleme // Check for value space handleValueSpaceAttribute(xmlConfigurationSettingsElementContent, configurationAccessContext); - // Handle access - if (!configurationAccessContext.serializeOut()) { - - // Write to blackboard - if (!doSetValue(xmlConfigurationSettingsElementContent.getTextContent(), getOffset() - configurationAccessContext.getBaseOffset(), configurationAccessContext)) { - - // Append parameter path to error - configurationAccessContext.appendToError(" " + getPath()); - - return false; - } - } else { - - // Get string value - string strValue; - - doGetValue(strValue, getOffset() - configurationAccessContext.getBaseOffset(), configurationAccessContext); - - // Populate value into xml text node - xmlConfigurationSettingsElementContent.setTextContent(strValue); - } - - // Done - return true; + // Base + return base::serializeXmlSettings(xmlConfigurationSettingsElementContent, configurationAccessContext); } + // Value space handling for configuration import void CParameter::handleValueSpaceAttribute(CXmlElement& xmlConfigurableElementSettingsElement, CConfigurationAccessContext& configurationAccessContext) const { @@ -98,18 +73,6 @@ uint32_t CParameter::getSize() const return static_cast(getTypeElement())->getSize(); } -// Dump -void CParameter::logValue(string& strValue, CErrorContext& errorContext) const -{ - CParameterAccessContext& parameterContext = static_cast(errorContext); - - // Dump value - doGetValue(strValue, getOffset(), parameterContext); - - // Prepend unit if any - prependUnit(strValue); -} - // Used for simulation only void CParameter::setDefaultValues(CParameterAccessContext& parameterAccessContext) const { @@ -123,63 +86,7 @@ void CParameter::setDefaultValues(CParameterAccessContext& parameterAccessContex pBlackboard->write(&uiDefaultValue, getSize(), getOffset(), parameterAccessContext.isBigEndianSubsystem()); } -// Unit -void CParameter::prependUnit(string& strValue) const -{ - string strUnit = static_cast(getTypeElement())->getUnit(); - - if (!strUnit.empty()) { - - strValue = "(" + strUnit + ") " + strValue; - } -} - -// Parameter Access -bool CParameter::setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const -{ - // Check path validity - if (!checkPathExhausted(pathNavigator, errorContext)) { - - return false; - } - // Parameter context - CParameterAccessContext& parameterContext = static_cast(errorContext); - - // Set Value - if (!doSetValue(strValue, getOffset(), parameterContext)) { - - // Append parameter path to error - parameterContext.appendToError(" " + getPath()); - - return false; - } - // Synchronize - if (parameterContext.getAutoSync() && !sync(parameterContext)) { - - // Append parameter path to error - parameterContext.appendToError(" " + getPath()); - - return false; - } - return true; -} - -bool CParameter::getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const -{ - // Check path validity - if (!checkPathExhausted(pathNavigator, errorContext)) { - - return false; - } - // Parameter context - CParameterAccessContext& parameterContext = static_cast(errorContext); - - // Get Value - doGetValue(strValue, getOffset(), parameterContext); - - return true; -} - +// Actual parameter access bool CParameter::doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const { uint32_t uiData; -- cgit v1.1