diff options
author | Patrick Benavoli <patrickx.benavoli@intel.com> | 2011-08-31 11:23:24 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-10 17:14:53 +0100 |
commit | 2ecf900ad8c30ce9f8e81f57977a1a80a6f6d8af (patch) | |
tree | 30a4b54da922580eefa34963585116657c2816fc /parameter/BitParameter.cpp | |
parent | 6ba361d96bc2581667b3400f87ff89fae6449e1f (diff) | |
download | external_parameter-framework-2ecf900ad8c30ce9f8e81f57977a1a80a6f6d8af.zip external_parameter-framework-2ecf900ad8c30ce9f8e81f57977a1a80a6f6d8af.tar.gz external_parameter-framework-2ecf900ad8c30ce9f8e81f57977a1a80a6f6d8af.tar.bz2 |
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 <patrickx.benavoli@intel.com>
Reviewed-on: http://android.intel.com:8080/16879
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/BitParameter.cpp')
-rw-r--r-- | parameter/BitParameter.cpp | 96 |
1 files changed, 7 insertions, 89 deletions
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<const CBitParameterBlock*>(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<CParameterAccessContext&>(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<CParameterAccessContext&>(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<CParameterAccessContext&>(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<const CBitParameterType*>(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<const CBitParameterType*>(getTypeElement())->asString(uiData, strValue, parameterAccessContext); |