aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Benavoli <patrickx.benavoli@intel.com>2011-08-31 11:23:24 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-10 17:14:53 +0100
commit2ecf900ad8c30ce9f8e81f57977a1a80a6f6d8af (patch)
tree30a4b54da922580eefa34963585116657c2816fc
parent6ba361d96bc2581667b3400f87ff89fae6449e1f (diff)
downloadexternal_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>
-rw-r--r--parameter/Android.mk3
-rw-r--r--parameter/ArrayParameter.cpp65
-rw-r--r--parameter/ArrayParameter.h17
-rw-r--r--parameter/BaseParameter.cpp122
-rw-r--r--parameter/BaseParameter.h56
-rw-r--r--parameter/BitParameter.cpp96
-rw-r--r--parameter/BitParameter.h22
-rw-r--r--parameter/BitParameterType.cpp16
-rw-r--r--parameter/BitParameterType.h3
-rw-r--r--parameter/ConfigurableElement.cpp31
-rw-r--r--parameter/ConfigurableElement.h7
-rw-r--r--parameter/Element.cpp28
-rw-r--r--parameter/Element.h7
-rw-r--r--parameter/FixedPointParameterType.cpp13
-rw-r--r--parameter/FixedPointParameterType.h3
-rw-r--r--parameter/InstanceConfigurableElement.cpp11
-rw-r--r--parameter/InstanceConfigurableElement.h3
-rw-r--r--parameter/IntegerParameterType.cpp21
-rw-r--r--parameter/IntegerParameterType.h3
-rw-r--r--parameter/Parameter.cpp103
-rw-r--r--parameter/Parameter.h19
-rw-r--r--parameter/ParameterBlockType.cpp12
-rw-r--r--parameter/ParameterMgr.cpp25
-rw-r--r--parameter/ParameterMgr.h1
-rw-r--r--parameter/ParameterType.cpp19
-rw-r--r--parameter/ParameterType.h5
-rw-r--r--parameter/Subsystem.cpp12
-rw-r--r--parameter/Subsystem.h4
-rw-r--r--parameter/TypeElement.cpp7
-rw-r--r--parameter/TypeElement.h5
-rw-r--r--remote-process/main.cpp2
31 files changed, 437 insertions, 304 deletions
diff --git a/parameter/Android.mk b/parameter/Android.mk
index 3ed382f..3e430ce 100644
--- a/parameter/Android.mk
+++ b/parameter/Android.mk
@@ -82,7 +82,8 @@ LOCAL_SRC_FILES:= \
SimulatedBackSynchronizer.cpp \
MappingContext.cpp \
SubsystemObject.cpp \
- SubsystemObjectCreator.cpp
+ SubsystemObjectCreator.cpp \
+ BaseParameter.cpp
LOCAL_MODULE:= libparameter
diff --git a/parameter/ArrayParameter.cpp b/parameter/ArrayParameter.cpp
index abb3f6d..5e0ea1e 100644
--- a/parameter/ArrayParameter.cpp
+++ b/parameter/ArrayParameter.cpp
@@ -38,13 +38,30 @@
#define base CParameter
-CArrayParameter::CArrayParameter(const string& strName, const CTypeElement* pTypeElement, uint32_t uiLength) : base(strName, pTypeElement), _uiLength(uiLength)
+CArrayParameter::CArrayParameter(const string& strName, const CTypeElement* pTypeElement) : base(strName, pTypeElement)
{
}
uint32_t CArrayParameter::getFootPrint() const
{
- return getSize() * _uiLength;
+ return getSize() * getArrayLength();
+}
+
+// Array length
+uint32_t CArrayParameter::getArrayLength() const
+{
+ return getTypeElement()->getArrayLength();
+}
+
+// Element properties
+void CArrayParameter::showProperties(string& strResult) const
+{
+ base::showProperties(strResult);
+
+ // Array length
+ strResult += "Array length: ";
+ strResult += toString(getArrayLength());
+ strResult += "\n";
}
// XML configuration settings parsing
@@ -78,10 +95,8 @@ bool CArrayParameter::serializeXmlSettings(CXmlElement& xmlConfigurationSettings
}
// User set/get
-bool CArrayParameter::setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const
+bool CArrayParameter::setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const
{
- CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(errorContext);
-
uint32_t uiStartIndex;
if (!getIndex(pathNavigator, uiStartIndex, parameterContext)) {
@@ -105,7 +120,7 @@ bool CArrayParameter::setValue(CPathNavigator& pathNavigator, const string& strV
if (parameterContext.getAutoSync() && !sync(parameterContext)) {
// Append parameter path to error
- errorContext.appendToError(" " + getPath());
+ parameterContext.appendToError(" " + getPath());
return false;
}
@@ -113,9 +128,8 @@ bool CArrayParameter::setValue(CPathNavigator& pathNavigator, const string& strV
return true;
}
-bool CArrayParameter::getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const
+bool CArrayParameter::getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const
{
- CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(errorContext);
uint32_t uiIndex;
if (!getIndex(pathNavigator, uiIndex, parameterContext)) {
@@ -137,13 +151,11 @@ bool CArrayParameter::getValue(CPathNavigator& pathNavigator, string& strValue,
void CArrayParameter::logValue(string& strValue, CErrorContext& errorContext) const
{
+ // Parameter context
CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(errorContext);
// Dump values
getValues(0, strValue, parameterContext);
-
- // Prepend unit if any
- prependUnit(strValue);
}
// Used for simulation only
@@ -160,8 +172,9 @@ void CArrayParameter::setDefaultValues(CParameterAccessContext& parameterAccessC
uint32_t uiSize = getSize();
uint32_t uiOffset = getOffset();
bool bSubsystemIsBigEndian = parameterAccessContext.isBigEndianSubsystem();
+ uint32_t uiArrayLength = getArrayLength();
- for (uiValueIndex = 0; uiValueIndex < _uiLength; uiValueIndex++) {
+ for (uiValueIndex = 0; uiValueIndex < uiArrayLength; uiValueIndex++) {
// Beware this code works on little endian architectures only!
pBlackboard->write(&uiDefaultValue, uiSize, uiOffset, bSubsystemIsBigEndian);
@@ -171,7 +184,7 @@ void CArrayParameter::setDefaultValues(CParameterAccessContext& parameterAccessC
}
// Index from path
-bool CArrayParameter::getIndex(CPathNavigator& pathNavigator, uint32_t& uiIndex, CErrorContext& errorContext) const
+bool CArrayParameter::getIndex(CPathNavigator& pathNavigator, uint32_t& uiIndex, CParameterAccessContext& parameterContext) const
{
uiIndex = (uint32_t)-1;
@@ -186,17 +199,17 @@ bool CArrayParameter::getIndex(CPathNavigator& pathNavigator, uint32_t& uiIndex,
if (!iss) {
- errorContext.setError("Expected numerical expression as last item in " + pathNavigator.getCurrentPath());
+ parameterContext.setError("Expected numerical expression as last item in " + pathNavigator.getCurrentPath());
return false;
}
- if (uiIndex >= _uiLength) {
+ if (uiIndex >= getArrayLength()) {
ostringstream oss;
- oss << "Provided index out of range (max is " << _uiLength - 1 << ")";
+ oss << "Provided index out of range (max is " << getArrayLength() - 1 << ")";
- errorContext.setError(oss.str());
+ parameterContext.setError(oss.str());
return false;
}
@@ -207,7 +220,7 @@ bool CArrayParameter::getIndex(CPathNavigator& pathNavigator, uint32_t& uiIndex,
if (pStrChildName) {
// Should be leaf element
- errorContext.setError("Path not found: " + pathNavigator.getCurrentPath());
+ parameterContext.setError("Path not found: " + pathNavigator.getCurrentPath());
return false;
}
@@ -226,7 +239,7 @@ bool CArrayParameter::setValues(uint32_t uiStartIndex, uint32_t uiBaseOffset, co
uint32_t uiNbValues = astrValues.size();
// Check number of provided values
- if (uiNbValues + uiStartIndex > _uiLength) {
+ if (uiNbValues + uiStartIndex > getArrayLength()) {
// Out of bounds
parameterContext.setError("Too many values provided");
@@ -244,7 +257,7 @@ bool CArrayParameter::setValues(uint32_t uiStartIndex, uint32_t uiBaseOffset, co
if (!doSetValue(astrValues[uiValueIndex], uiOffset, parameterContext)) {
// Append parameter path to error
- parameterContext.appendToError(" " + getPath() + "/" + getIndexAsString(uiValueIndex + uiStartIndex));
+ parameterContext.appendToError(" " + getPath() + "/" + toString(uiValueIndex + uiStartIndex));
return false;
}
@@ -260,10 +273,11 @@ void CArrayParameter::getValues(uint32_t uiBaseOffset, string& strValues, CParam
uint32_t uiValueIndex;
uint32_t uiSize = getSize();
uint32_t uiOffset = getOffset() - uiBaseOffset;
+ uint32_t uiArrayLength = getArrayLength();
bool bFirst = true;
- for (uiValueIndex = 0; uiValueIndex < _uiLength; uiValueIndex++) {
+ for (uiValueIndex = 0; uiValueIndex < uiArrayLength; uiValueIndex++) {
string strReadValue;
doGetValue(strReadValue, uiOffset, parameterContext);
@@ -281,12 +295,3 @@ void CArrayParameter::getValues(uint32_t uiBaseOffset, string& strValues, CParam
uiOffset += uiSize;
}
}
-
-string CArrayParameter::getIndexAsString(uint32_t uiIndex)
-{
- ostringstream strStream;
-
- strStream << uiIndex;
-
- return strStream.str();
-}
diff --git a/parameter/ArrayParameter.h b/parameter/ArrayParameter.h
index bcedfad..9ee1be0 100644
--- a/parameter/ArrayParameter.h
+++ b/parameter/ArrayParameter.h
@@ -35,7 +35,7 @@
class CArrayParameter : public CParameter
{
public:
- CArrayParameter(const string& strName, const CTypeElement* pTypeElement, uint32_t uiLength);
+ CArrayParameter(const string& strName, const CTypeElement* pTypeElement);
// Instantiation, allocation
virtual uint32_t getFootPrint() const;
@@ -44,22 +44,21 @@ public:
virtual bool serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const;
protected:
// User set/get
- virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const;
- virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const;
+ virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const;
+ virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const;
virtual void logValue(string& strValue, CErrorContext& errorContext) const;
// Used for simulation only
virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const;
+ // Element properties
+ virtual void showProperties(string& strResult) const;
private:
+ // Array length
+ uint32_t getArrayLength() const;
// Common set value processing
bool setValues(uint32_t uiStartIndex, uint32_t uiBaseOffset, const string& strValue, CParameterAccessContext& parameterContext) const;
// Log / get values common
void getValues(uint32_t uiBaseOffset, string& strValues, CParameterAccessContext& parameterContext) const;
// Index retrieval from user set/get request
- bool getIndex(CPathNavigator& pathNavigator, uint32_t& uiIndex, CErrorContext& errorContext) const;
- // Int to string conversion utility
- static string getIndexAsString(uint32_t uiIndex);
-
- // Array length
- uint32_t _uiLength;
+ bool getIndex(CPathNavigator& pathNavigator, uint32_t& uiIndex, CParameterAccessContext& parameterContext) const;
};
diff --git a/parameter/BaseParameter.cpp b/parameter/BaseParameter.cpp
new file mode 100644
index 0000000..67349d4
--- /dev/null
+++ b/parameter/BaseParameter.cpp
@@ -0,0 +1,122 @@
+/* <auto_header>
+ * <FILENAME>
+ *
+ * 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.
+ *
+ * AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com)
+ * CREATED: 2011-06-01
+ * UPDATED: 2011-07-27
+ *
+ *
+ * </auto_header>
+ */
+#include "BaseParameter.h"
+#include "ParameterType.h"
+#include "ParameterAccessContext.h"
+#include "ConfigurationAccessContext.h"
+#include "ParameterBlackboard.h"
+
+#define base CInstanceConfigurableElement
+
+CBaseParameter::CBaseParameter(const string& strName, const CTypeElement* pTypeElement) : base(strName, pTypeElement)
+{
+}
+
+// XML configuration settings parsing/composing
+bool CBaseParameter::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;
+}
+
+// Dump
+void CBaseParameter::logValue(string& strValue, CErrorContext& errorContext) const
+{
+ // Parameter context
+ CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(errorContext);
+
+ // Dump value
+ doGetValue(strValue, getOffset(), parameterContext);
+}
+
+// Parameter Access
+bool CBaseParameter::setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const
+{
+ // Check path validity
+ if (!checkPathExhausted(pathNavigator, parameterContext)) {
+
+ return false;
+ }
+
+ // 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 CBaseParameter::getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const
+{
+ // Check path validity
+ if (!checkPathExhausted(pathNavigator, parameterContext)) {
+
+ return false;
+ }
+
+ // Get Value
+ doGetValue(strValue, getOffset(), parameterContext);
+
+ return true;
+}
diff --git a/parameter/BaseParameter.h b/parameter/BaseParameter.h
new file mode 100644
index 0000000..e8f82ed
--- /dev/null
+++ b/parameter/BaseParameter.h
@@ -0,0 +1,56 @@
+/* <auto_header>
+ * <FILENAME>
+ *
+ * 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.
+ *
+ * AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com)
+ * CREATED: 2011-06-01
+ * UPDATED: 2011-07-27
+ *
+ *
+ * </auto_header>
+ */
+#pragma once
+
+#include <stdint.h>
+
+#include "InstanceConfigurableElement.h"
+
+class CParameterAccessContext;
+class CConfigurationAccessContext;
+
+class CBaseParameter : public CInstanceConfigurableElement
+{
+public:
+ CBaseParameter(const string& strName, const CTypeElement* pTypeElement);
+
+ // XML configuration settings parsing/composing
+ virtual bool serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const;
+protected:
+ // Parameter Access
+ virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const;
+ virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const;
+ virtual void logValue(string& strValue, CErrorContext& errorContext) const;
+
+ // Actual value access (to be implemented by derived)
+ virtual bool doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const = 0;
+ virtual void doGetValue(string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const = 0;
+};
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);
diff --git a/parameter/BitParameter.h b/parameter/BitParameter.h
index 41f449e..5f62cf3 100644
--- a/parameter/BitParameter.h
+++ b/parameter/BitParameter.h
@@ -32,12 +32,9 @@
#include <stdint.h>
-#include "InstanceConfigurableElement.h"
+#include "BaseParameter.h"
-class CParameterAccessContext;
-class CConfigurationAccessContext;
-
-class CBitParameter : public CInstanceConfigurableElement
+class CBitParameter : public CBaseParameter
{
public:
CBitParameter(const string& strName, const CTypeElement* pTypeElement);
@@ -47,20 +44,11 @@ public:
// Type
virtual Type getType() const;
-
- // XML configuration settings parsing/composing
- virtual bool serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const;
-protected:
- // Parameter Access
- virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const;
- virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const;
- virtual void logValue(string& strValue, CErrorContext& errorContext) const;
private:
// Size
- uint32_t getSize() const;
+ uint32_t getBelongingBlockSize() const;
// Actual Access
- bool doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const;
- void doGetValue(string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const;
-
+ virtual bool doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const;
+ virtual void doGetValue(string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const;
};
diff --git a/parameter/BitParameterType.cpp b/parameter/BitParameterType.cpp
index d9d1861..d4833e3 100644
--- a/parameter/BitParameterType.cpp
+++ b/parameter/BitParameterType.cpp
@@ -47,6 +47,22 @@ string CBitParameterType::getKind() const
return "BitParameter";
}
+// Element properties
+void CBitParameterType::showProperties(string& strResult) const
+{
+ base::showProperties(strResult);
+
+ // Bit Pos
+ strResult += "Bit pos: ";
+ strResult += toString(_uiBitPos);
+ strResult += "\n";
+
+ // Bit size
+ strResult += "Bit size: ";
+ strResult += toString(_uiBitSize);
+ strResult += "\n";
+}
+
// From IXmlSink
bool CBitParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
diff --git a/parameter/BitParameterType.h b/parameter/BitParameterType.h
index f3f18b8..b8afeec 100644
--- a/parameter/BitParameterType.h
+++ b/parameter/BitParameterType.h
@@ -51,6 +51,9 @@ public:
// Bit Size
uint32_t getBitSize() const;
+ // Element properties
+ virtual void showProperties(string& strResult) const;
+
// CElement
virtual string getKind() const;
private:
diff --git a/parameter/ConfigurableElement.cpp b/parameter/ConfigurableElement.cpp
index 2fcde7a..f439ebf 100644
--- a/parameter/ConfigurableElement.cpp
+++ b/parameter/ConfigurableElement.cpp
@@ -34,7 +34,6 @@
#include "ConfigurableDomain.h"
#include "ConfigurationAccessContext.h"
#include "ConfigurableElementAggregator.h"
-#include <sstream>
#include <assert.h>
#define base CElement
@@ -128,13 +127,13 @@ bool CConfigurableElement::serializeXmlSettings(CXmlElement& xmlConfigurationSet
}
// Parameter access
-bool CConfigurableElement::setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const
+bool CConfigurableElement::setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const
{
string* pStrChildName = pathNavigator.next();
if (!pStrChildName) {
- errorContext.setError("Non settable element");
+ parameterContext.setError("Non settable element");
return false;
}
@@ -143,21 +142,21 @@ bool CConfigurableElement::setValue(CPathNavigator& pathNavigator, const string&
if (!pChild) {
- errorContext.setError("Path not found: " + pathNavigator.getCurrentPath());
+ parameterContext.setError("Path not found: " + pathNavigator.getCurrentPath());
return false;
}
- return pChild->setValue(pathNavigator, strValue, errorContext);
+ return pChild->setValue(pathNavigator, strValue, parameterContext);
}
-bool CConfigurableElement::getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const
+bool CConfigurableElement::getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const
{
string* pStrChildName = pathNavigator.next();
if (!pStrChildName) {
- errorContext.setError("Non gettable element");
+ parameterContext.setError("Non gettable element");
return false;
}
@@ -166,12 +165,12 @@ bool CConfigurableElement::getValue(CPathNavigator& pathNavigator, string& strVa
if (!pChild) {
- errorContext.setError("Path not found: " + pathNavigator.getCurrentPath());
+ parameterContext.setError("Path not found: " + pathNavigator.getCurrentPath());
return false;
}
- return pChild->getValue(pathNavigator, strValue, errorContext);
+ return pChild->getValue(pathNavigator, strValue, parameterContext);
}
// Used for simulation only
@@ -189,6 +188,14 @@ void CConfigurableElement::setDefaultValues(CParameterAccessContext& parameterAc
}
}
+// Element properties
+void CConfigurableElement::showProperties(string& strResult) const
+{
+ base::showProperties(strResult);
+
+ strResult += "Total size: " + getFootprintAsString() + "\n";
+}
+
// Offset
void CConfigurableElement::setOffset(uint32_t uiOffset)
{
@@ -350,11 +357,7 @@ void CConfigurableElement::listRogueElements(string& strResult) const
string CConfigurableElement::getFootprintAsString() const
{
// Get size as string
- ostringstream str;
-
- str << getFootPrint() << " bytes";
-
- return str.str();
+ return toString(getFootPrint()) + " byte(s)";
}
// Matching check for no domain association
diff --git a/parameter/ConfigurableElement.h b/parameter/ConfigurableElement.h
index 34ade12..de9bcd5 100644
--- a/parameter/ConfigurableElement.h
+++ b/parameter/ConfigurableElement.h
@@ -82,11 +82,14 @@ public:
string getFootprintAsString() const;
// Parameter access
- virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const;
- virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const;
+ virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const;
+ virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const;
// Used for simulation only
virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const;
+ // Element properties
+ virtual void showProperties(string& strResult) const;
+
// XML configuration settings parsing
virtual bool serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const;
protected:
diff --git a/parameter/Element.cpp b/parameter/Element.cpp
index 7b892b0..915bc65 100644
--- a/parameter/Element.cpp
+++ b/parameter/Element.cpp
@@ -32,6 +32,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
+#include <sstream>
#include "XmlElementSerializingContext.h"
#include "ElementLibrary.h"
#include "ErrorContext.h"
@@ -157,6 +158,33 @@ void CElement::dumpContent(string& strContent, CErrorContext& errorContext, cons
}
}
+// Element properties
+void CElement::showProperties(string& strResult) const
+{
+ strResult = "\n";
+ strResult += "Kind: " + getKind() + "\n";
+}
+
+// Conversion utilities
+string CElement::toString(uint32_t uiValue)
+{
+ ostringstream ostr;
+
+ ostr << uiValue;
+
+ return ostr.str();
+}
+
+string CElement::toString(int32_t iValue)
+{
+ ostringstream ostr;
+
+ ostr << iValue;
+
+ return ostr.str();
+}
+
+// Content dumping
void CElement::logValue(string& strValue, CErrorContext& errorContext) const
{
(void)strValue;
diff --git a/parameter/Element.h b/parameter/Element.h
index e31d772..99e7d10 100644
--- a/parameter/Element.h
+++ b/parameter/Element.h
@@ -96,6 +96,13 @@ public:
// Content structure dump
void dumpContent(string& strContent, CErrorContext& errorContext, const uint32_t uiDepth = 0) const;
+ // Element properties
+ virtual void showProperties(string& strResult) const;
+
+ // Conversion utilities
+ static string toString(uint32_t uiValue);
+ static string toString(int32_t iValue);
+
// Checksum for integrity checks
uint8_t computeStructureChecksum() const;
diff --git a/parameter/FixedPointParameterType.cpp b/parameter/FixedPointParameterType.cpp
index a3c9bc5..fb986c5 100644
--- a/parameter/FixedPointParameterType.cpp
+++ b/parameter/FixedPointParameterType.cpp
@@ -48,6 +48,19 @@ string CFixedPointParameterType::getKind() const
return "FixedPointParameter";
}
+// Element properties
+void CFixedPointParameterType::showProperties(string& strResult) const
+{
+ base::showProperties(strResult);
+
+ // Notation
+ strResult += "Notation: Q";
+ strResult += toString(_uiIntegral);
+ strResult += ".";
+ strResult += toString(_uiFractional);
+ strResult += "\n";
+}
+
// XML Serialization value space handling
// Value space handling for configuration import
void CFixedPointParameterType::handleValueSpaceAttribute(CXmlElement& xmlConfigurableElementSettingsElement, CConfigurationAccessContext& configurationAccessContext) const
diff --git a/parameter/FixedPointParameterType.h b/parameter/FixedPointParameterType.h
index c0ffef3..78b0b7e 100644
--- a/parameter/FixedPointParameterType.h
+++ b/parameter/FixedPointParameterType.h
@@ -48,6 +48,9 @@ public:
virtual bool asInteger(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
virtual void asString(const uint32_t& uiValue, string& strValue, CParameterAccessContext& parameterAccessContext) const;
+ // Element properties
+ virtual void showProperties(string& strResult) const;
+
// CElement
virtual string getKind() const;
private:
diff --git a/parameter/InstanceConfigurableElement.cpp b/parameter/InstanceConfigurableElement.cpp
index fdce2b7..70c6d89 100644
--- a/parameter/InstanceConfigurableElement.cpp
+++ b/parameter/InstanceConfigurableElement.cpp
@@ -45,7 +45,7 @@ CInstanceConfigurableElement::CInstanceConfigurableElement(const string& strName
string CInstanceConfigurableElement::getKind() const
{
// Delegate
- return getTypeElement()->getKind();
+ return _pTypeElement->getKind();
}
// Type element
@@ -96,6 +96,15 @@ bool CInstanceConfigurableElement::map(IMapper& mapper, string& strError)
return true;
}
+// Element properties
+void CInstanceConfigurableElement::showProperties(string& strResult) const
+{
+ base::showProperties(strResult);
+
+ // Delegate to type element
+ _pTypeElement->showProperties(strResult);
+}
+
// Sync to HW
void CInstanceConfigurableElement::setSyncer(ISyncer* pSyncer)
{
diff --git a/parameter/InstanceConfigurableElement.h b/parameter/InstanceConfigurableElement.h
index 4a032d4..232621a 100644
--- a/parameter/InstanceConfigurableElement.h
+++ b/parameter/InstanceConfigurableElement.h
@@ -68,6 +68,9 @@ public:
// Mapping execution
bool map(IMapper& mapper, string& strError);
+
+ // Element properties
+ virtual void showProperties(string& strResult) const;
protected:
// Syncer
virtual ISyncer* getSyncer() const;
diff --git a/parameter/IntegerParameterType.cpp b/parameter/IntegerParameterType.cpp
index 72491a2..1f20c93 100644
--- a/parameter/IntegerParameterType.cpp
+++ b/parameter/IntegerParameterType.cpp
@@ -45,6 +45,27 @@ string CIntegerParameterType::getKind() const
return "IntegerParameter";
}
+// Element properties
+void CIntegerParameterType::showProperties(string& strResult) const
+{
+ base::showProperties(strResult);
+
+ // Sign
+ strResult += "Signed: ";
+ strResult += _bSigned ? "yes" : "no";
+ strResult += "\n";
+
+ // Min
+ strResult += "Min: ";
+ strResult += _bSigned ? toString((int32_t)_uiMin) : toString(_uiMin);
+ strResult += "\n";
+
+ // Max
+ strResult += "Max: ";
+ strResult += _bSigned ? toString((int32_t)_uiMax) : toString(_uiMax);
+ strResult += "\n";
+}
+
bool CIntegerParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
// Sign
diff --git a/parameter/IntegerParameterType.h b/parameter/IntegerParameterType.h
index db4be41..50a7f91 100644
--- a/parameter/IntegerParameterType.h
+++ b/parameter/IntegerParameterType.h
@@ -47,6 +47,9 @@ public:
// Default value handling (simulation only)
virtual uint32_t getDefaultValue() const;
+ // Element properties
+ virtual void showProperties(string& strResult) const;
+
// CElement
virtual string getKind() const;
private:
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<const CParameterType*>(getTypeElement())->getSize();
}
-// Dump
-void CParameter::logValue(string& strValue, CErrorContext& errorContext) const
-{
- CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(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<const CParameterType*>(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<CParameterAccessContext&>(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<CParameterAccessContext&>(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;
diff --git a/parameter/Parameter.h b/parameter/Parameter.h
index c62f151..50a8999 100644
--- a/parameter/Parameter.h
+++ b/parameter/Parameter.h
@@ -32,16 +32,12 @@
#include <stdint.h>
-#include "InstanceConfigurableElement.h"
+#include "BaseParameter.h"
-class CParameterAccessContext;
-class CConfigurationAccessContext;
-
-class CParameter : public CInstanceConfigurableElement
+class CParameter : public CBaseParameter
{
public:
CParameter(const string& strName, const CTypeElement* pTypeElement);
- virtual ~CParameter();
// Instantiation, allocation
virtual uint32_t getFootPrint() const;
@@ -52,23 +48,16 @@ public:
// XML configuration settings parsing/composing
virtual bool serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const;
protected:
- // Parameter Access
- virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const;
- virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const;
- virtual void logValue(string& strValue, CErrorContext& errorContext) const;
// Used for simulation only
virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const;
// Actual value access
- bool doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const;
- void doGetValue(string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const;
+ virtual bool doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const;
+ virtual void doGetValue(string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const;
// Value space handling for configuration import
void handleValueSpaceAttribute(CXmlElement& xmlConfigurableElementSettingsElement, CConfigurationAccessContext& configurationAccessContext) const;
// Size
uint32_t getSize() const;
-
- // Unit
- void prependUnit(string& strValue) const;
};
diff --git a/parameter/ParameterBlockType.cpp b/parameter/ParameterBlockType.cpp
index 57cd3c0..7b01b64 100644
--- a/parameter/ParameterBlockType.cpp
+++ b/parameter/ParameterBlockType.cpp
@@ -30,7 +30,6 @@
*/
#include "ParameterBlockType.h"
#include "ParameterBlock.h"
-#include <sstream>
#define base CTypeElement
@@ -64,7 +63,7 @@ void CParameterBlockType::populate(CElement* pElement) const
for (uiChild = 0; uiChild < uiArrayLength; uiChild++) {
- CParameterBlock* pChildParameterBlock = new CParameterBlock(computeChildName(uiChild), this);
+ CParameterBlock* pChildParameterBlock = new CParameterBlock(toString(uiChild), this);
pElement->addChild(pChildParameterBlock);
@@ -75,12 +74,3 @@ void CParameterBlockType::populate(CElement* pElement) const
base::populate(pElement);
}
}
-
-string CParameterBlockType::computeChildName(uint32_t uiChild)
-{
- ostringstream strStream;
-
- strStream << uiChild;
-
- return strStream.str();
-}
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 3ff76a5..b27a1b5 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -142,8 +142,9 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gaRemoteCommandPars
{ "listParameters", &CParameterMgr::listParametersCommmandProcess, 1, "<elem path>|/", "Recursively list elements under element at given path or root" },
{ "dumpElement", &CParameterMgr::dumpElementCommmandProcess, 1, "<elem path>", "Dump structure and content of element at given path" },
{ "getElementSize", &CParameterMgr::getElementSizeCommmandProcess, 1, "<elem path>", "Show size of element at given path" },
- { "getParameter", &CParameterMgr::getParameterCommmandProcess, 1, "<elem ath>", "Get value for parameter at given path" },
- { "setParameter", &CParameterMgr::setParameterCommmandProcess, 2, "<elem path> <value>", "Set value for parameter at given path" },
+ { "showProperties", &CParameterMgr::showPropertiesCommmandProcess, 1, "<elem path>", "Show properties of element at given path" },
+ { "getParameter", &CParameterMgr::getParameterCommmandProcess, 1, "<param ath>", "Get value for parameter at given path" },
+ { "setParameter", &CParameterMgr::setParameterCommmandProcess, 2, "<param path> <value>", "Set value for parameter at given path" },
{ "listBelongingDomains", &CParameterMgr::listBelongingDomainsCommmandProcess, 1, "<elem path>", "List domain(s) element at given path is contained in" },
{ "listAssociatedDomains", &CParameterMgr::listAssociatedDomainsCommmandProcess, 1, "<elem path>", "List domain(s) element at given path is associated to" },
/// Browse
@@ -1040,6 +1041,26 @@ CParameterMgr::CommandStatus CParameterMgr::getElementSizeCommmandProcess(const
return ESucceeded;
}
+CParameterMgr::CommandStatus CParameterMgr::showPropertiesCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+{
+ CElementLocator elementLocator(getSystemClass());
+
+ CElement* pLocatedElement = NULL;
+
+ if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) {
+
+ return EFailed;
+ }
+
+ // Convert element
+ const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement);
+
+ // Return element properties
+ pConfigurableElement->showProperties(strResult);
+
+ return ESucceeded;
+}
+
CParameterMgr::CommandStatus CParameterMgr::getParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
string strValue;
diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h
index e1843d9..003a643 100644
--- a/parameter/ParameterMgr.h
+++ b/parameter/ParameterMgr.h
@@ -217,6 +217,7 @@ private:
CommandStatus listParametersCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
CommandStatus dumpElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
CommandStatus getElementSizeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
+ CommandStatus showPropertiesCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
CommandStatus getParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
CommandStatus setParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
CommandStatus listBelongingDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
diff --git a/parameter/ParameterType.cpp b/parameter/ParameterType.cpp
index 054c5e8..53d10e6 100644
--- a/parameter/ParameterType.cpp
+++ b/parameter/ParameterType.cpp
@@ -69,7 +69,7 @@ bool CParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializingConte
}
// XML Serialization value space handling
-// Value space handling for configuration import
+// Value space handling for configuration import/export
void CParameterType::handleValueSpaceAttribute(CXmlElement& xmlConfigurableElementSettingsElement, CConfigurationAccessContext& configurationAccessContext) const
{
(void)xmlConfigurableElementSettingsElement;
@@ -77,6 +77,21 @@ void CParameterType::handleValueSpaceAttribute(CXmlElement& xmlConfigurableEleme
// Do nothing by default
}
+// Element properties
+void CParameterType::showProperties(string& strResult) const
+{
+ base::showProperties(strResult);
+
+ // Unit
+ if (!_strUnit.empty()) {
+
+ strResult += "Unit: " + _strUnit + "\n";
+ }
+
+ // Scalar size
+ strResult += "Scalar size: " + toString(_uiSize) + " byte(s) \n";
+}
+
// Default value handling (simulation only)
uint32_t CParameterType::getDefaultValue() const
{
@@ -91,7 +106,7 @@ CInstanceConfigurableElement* CParameterType::doInstantiate() const
return new CParameter(getName(), this);
} else {
// Array Parameter
- return new CArrayParameter(getName(), this, getArrayLength());
+ return new CArrayParameter(getName(), this);
}
}
diff --git a/parameter/ParameterType.h b/parameter/ParameterType.h
index 0c7e0ff..88ee0ea 100644
--- a/parameter/ParameterType.h
+++ b/parameter/ParameterType.h
@@ -57,9 +57,12 @@ public:
virtual void asString(const uint32_t& uiValue, string& strValue, CParameterAccessContext& parameterAccessContext) const = 0;
// XML Serialization value space handling
- // Value space handling for configuration import
+ // Value space handling for configuration import/export
virtual void handleValueSpaceAttribute(CXmlElement& xmlConfigurableElementSettingsElement, CConfigurationAccessContext& configurationAccessContext) const;
+ // Element properties
+ virtual void showProperties(string& strResult) const;
+
// Default value handling (simulation only)
virtual uint32_t getDefaultValue() const;
protected:
diff --git a/parameter/Subsystem.cpp b/parameter/Subsystem.cpp
index 25da60a..97de091 100644
--- a/parameter/Subsystem.cpp
+++ b/parameter/Subsystem.cpp
@@ -156,24 +156,20 @@ bool CSubsystem::mapSubsystemElements(string& strError)
}
// Parameter access
-bool CSubsystem::setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const
+bool CSubsystem::setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const
{
- CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(errorContext);
-
// Deal with Endianness
parameterContext.setBigEndianSubsystem(_bBigEndian);
- return base::setValue(pathNavigator, strValue, errorContext);
+ return base::setValue(pathNavigator, strValue, parameterContext);
}
-bool CSubsystem::getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const
+bool CSubsystem::getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const
{
- CParameterAccessContext& parameterContext = static_cast<CParameterAccessContext&>(errorContext);
-
// Deal with Endianness
parameterContext.setBigEndianSubsystem(_bBigEndian);
- return base::getValue(pathNavigator, strValue, errorContext);
+ return base::getValue(pathNavigator, strValue, parameterContext);
}
void CSubsystem::logValue(string& strValue, CErrorContext& errorContext) const
diff --git a/parameter/Subsystem.h b/parameter/Subsystem.h
index 14dcdb4..f0ddc57 100644
--- a/parameter/Subsystem.h
+++ b/parameter/Subsystem.h
@@ -62,8 +62,8 @@ public:
virtual string getKind() const;
protected:
// Parameter access
- virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CErrorContext& errorContext) const;
- virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CErrorContext& errorContext) const;
+ virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const;
+ virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const;
virtual void logValue(string& strValue, CErrorContext& errorContext) const;
// Used for simulation only
virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const;
diff --git a/parameter/TypeElement.cpp b/parameter/TypeElement.cpp
index 34b3ce0..9e96a7b 100644
--- a/parameter/TypeElement.cpp
+++ b/parameter/TypeElement.cpp
@@ -69,6 +69,13 @@ bool CTypeElement::hasMappingData() const
return !!_pMappingData;
}
+// Element properties
+void CTypeElement::showProperties(string& strResult) const
+{
+ (void)strResult;
+ // Prevent base from being called in that context!
+}
+
void CTypeElement::populate(CElement* pElement) const
{
// Populate children
diff --git a/parameter/TypeElement.h b/parameter/TypeElement.h
index 3468c35..5fe7500 100644
--- a/parameter/TypeElement.h
+++ b/parameter/TypeElement.h
@@ -48,16 +48,19 @@ public:
virtual bool getMappingData(const string& strKey, const string*& pStrValue) const;
virtual bool hasMappingData() const;
+ // Element properties
+ virtual void showProperties(string& strResult) const;
+
// From IXmlSink
virtual bool fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
// Scalar or Array?
bool isScalar() const;
-protected:
// Array Length
uint32_t getArrayLength() const;
+protected:
// Object creation
virtual void populate(CElement* pElement) const;
private:
diff --git a/remote-process/main.cpp b/remote-process/main.cpp
index 51d0fae..80c4d80 100644
--- a/remote-process/main.cpp
+++ b/remote-process/main.cpp
@@ -43,7 +43,7 @@ int main(int argc, char *argv[])
if (argc < 4) {
cerr << "Missing arguments" << endl;
- cerr << "Usage: " << argv[1] << " <target> <port> <cmd> <arg>*" << endl;
+ cerr << "Usage: " << argv[0] << " <target> <port> <cmd> <arg>*" << endl;
return -1;
}