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/BitParameter.cpp | 96 ++++------------------------------------------ 1 file changed, 7 insertions(+), 89 deletions(-) (limited to 'parameter/BitParameter.cpp') diff --git a/parameter/BitParameter.cpp b/parameter/BitParameter.cpp index cb75477..db1da38 100644 --- a/parameter/BitParameter.cpp +++ b/parameter/BitParameter.cpp @@ -35,7 +35,7 @@ #include "ParameterBlackboard.h" #include "BitParameterBlock.h" -#define base CInstanceConfigurableElement +#define base CBaseParameter CBitParameter::CBitParameter(const string& strName, const CTypeElement* pTypeElement) : base(strName, pTypeElement) { @@ -48,101 +48,19 @@ CInstanceConfigurableElement::Type CBitParameter::getType() const } // Size -uint32_t CBitParameter::getSize() const +uint32_t CBitParameter::getBelongingBlockSize() const { return static_cast(getParent())->getSize(); } -// XML configuration settings parsing/composing -bool CBitParameter::serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const -{ - // 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; -} - +// Instantiation, allocation uint32_t CBitParameter::getFootPrint() const { // Allocation made on parent side return 0; } -// Dump -void CBitParameter::logValue(string& strValue, CErrorContext& errorContext) const -{ - CParameterAccessContext& parameterContext = static_cast(errorContext); - - // Dump value - doGetValue(strValue, getOffset(), parameterContext); -} - -// Parameter Access -bool CBitParameter::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 (!sync(parameterContext)) { - - // Append parameter path to error - parameterContext.appendToError(" " + getPath()); - - return false; - } - return true; -} - -bool CBitParameter::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 CBitParameter::doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const { uint32_t uiData = 0; @@ -151,7 +69,7 @@ bool CBitParameter::doSetValue(const string& strValue, uint32_t uiOffset, CParam CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); // Beware this code works on little endian architectures only! - pBlackboard->read(&uiData, getSize(), uiOffset, parameterAccessContext.isBigEndianSubsystem()); + pBlackboard->read(&uiData, getBelongingBlockSize(), uiOffset, parameterAccessContext.isBigEndianSubsystem()); // Convert if (!static_cast(getTypeElement())->asInteger(strValue, uiData, parameterAccessContext)) { @@ -159,7 +77,7 @@ bool CBitParameter::doSetValue(const string& strValue, uint32_t uiOffset, CParam return false; } // Write blackboard - pBlackboard->write(&uiData, getSize(), uiOffset, parameterAccessContext.isBigEndianSubsystem()); + pBlackboard->write(&uiData, getBelongingBlockSize(), uiOffset, parameterAccessContext.isBigEndianSubsystem()); return true; } @@ -172,7 +90,7 @@ void CBitParameter::doGetValue(string& strValue, uint32_t uiOffset, CParameterAc CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); // Beware this code works on little endian architectures only! - pBlackboard->read(&uiData, getSize(), uiOffset, parameterAccessContext.isBigEndianSubsystem()); + pBlackboard->read(&uiData, getBelongingBlockSize(), uiOffset, parameterAccessContext.isBigEndianSubsystem()); // Convert static_cast(getTypeElement())->asString(uiData, strValue, parameterAccessContext); -- cgit v1.1