summaryrefslogtreecommitdiffstats
path: root/parameter
diff options
context:
space:
mode:
Diffstat (limited to 'parameter')
-rw-r--r--parameter/Android.mk3
-rw-r--r--parameter/CMakeLists.txt1
-rw-r--r--[-rwxr-xr-x]parameter/IntegerParameterType.cpp0
-rw-r--r--[-rwxr-xr-x]parameter/IntegerParameterType.h0
-rw-r--r--parameter/LinearParameterAdaptation.cpp7
-rw-r--r--parameter/LinearParameterAdaptation.h3
-rw-r--r--parameter/LogarithmicParameterAdaptation.cpp89
-rw-r--r--parameter/LogarithmicParameterAdaptation.h71
-rw-r--r--parameter/ParameterAccessContext.cpp2
-rw-r--r--parameter/ParameterAccessContext.h15
-rw-r--r--parameter/ParameterMgr.cpp95
-rw-r--r--parameter/ParameterMgr.h21
-rw-r--r--parameter/ParameterMgrFullConnector.cpp5
-rw-r--r--parameter/ParameterMgrPlatformConnector.cpp6
-rw-r--r--[-rwxr-xr-x]parameter/ParameterType.cpp0
-rw-r--r--[-rwxr-xr-x]parameter/ParameterType.h0
-rw-r--r--parameter/SelectionCriterion.cpp13
-rw-r--r--parameter/SelectionCriterion.h9
-rw-r--r--parameter/SelectionCriterionType.cpp23
-rw-r--r--parameter/SelectionCriterionType.h9
-rw-r--r--[-rwxr-xr-x]parameter/SubsystemObject.cpp0
-rw-r--r--[-rwxr-xr-x]parameter/SubsystemObject.h0
-rw-r--r--parameter/SystemClass.cpp26
-rw-r--r--parameter/SystemClass.h5
-rw-r--r--[-rwxr-xr-x]parameter/TypeElement.cpp0
-rw-r--r--[-rwxr-xr-x]parameter/TypeElement.h0
-rw-r--r--parameter/include/ParameterMgrFullConnector.h10
27 files changed, 332 insertions, 81 deletions
diff --git a/parameter/Android.mk b/parameter/Android.mk
index 8592c52..90e33f0 100644
--- a/parameter/Android.mk
+++ b/parameter/Android.mk
@@ -79,6 +79,7 @@ common_src_files := \
InstanceDefinition.cpp \
IntegerParameterType.cpp \
LinearParameterAdaptation.cpp \
+ LogarithmicParameterAdaptation.cpp \
MappingContext.cpp \
MappingData.cpp \
ParameterAccessContext.cpp \
@@ -155,6 +156,8 @@ LOCAL_C_INCLUDES := $(common_c_includes)
LOCAL_SHARED_LIBRARIES := $(common_shared_libraries) libdl
LOCAL_STATIC_LIBRARIES := libxmlserializer libpfw_utility libxml2
+LOCAL_REQUIRED_MODULES := libremote-processor
+
LOCAL_CLANG := false
include external/stlport/libstlport.mk
include $(BUILD_SHARED_LIBRARY)
diff --git a/parameter/CMakeLists.txt b/parameter/CMakeLists.txt
index 9f93da7..94369fb 100644
--- a/parameter/CMakeLists.txt
+++ b/parameter/CMakeLists.txt
@@ -64,6 +64,7 @@ add_library(parameter SHARED
InstanceDefinition.cpp
IntegerParameterType.cpp
LinearParameterAdaptation.cpp
+ LogarithmicParameterAdaptation.cpp
MappingContext.cpp
MappingData.cpp
ParameterAccessContext.cpp
diff --git a/parameter/IntegerParameterType.cpp b/parameter/IntegerParameterType.cpp
index edc3d46..edc3d46 100755..100644
--- a/parameter/IntegerParameterType.cpp
+++ b/parameter/IntegerParameterType.cpp
diff --git a/parameter/IntegerParameterType.h b/parameter/IntegerParameterType.h
index 53bd4a8..53bd4a8 100755..100644
--- a/parameter/IntegerParameterType.h
+++ b/parameter/IntegerParameterType.h
diff --git a/parameter/LinearParameterAdaptation.cpp b/parameter/LinearParameterAdaptation.cpp
index 4be92a9..ea833b3 100644
--- a/parameter/LinearParameterAdaptation.cpp
+++ b/parameter/LinearParameterAdaptation.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -37,6 +37,11 @@ CLinearParameterAdaptation::CLinearParameterAdaptation() : base("Linear"), _dSlo
{
}
+CLinearParameterAdaptation::CLinearParameterAdaptation(const string& strType) :
+ base(strType), _dSlopeNumerator(1), _dSlopeDenominator(1)
+{
+}
+
// Element properties
void CLinearParameterAdaptation::showProperties(string& strResult) const
{
diff --git a/parameter/LinearParameterAdaptation.h b/parameter/LinearParameterAdaptation.h
index f72f27b..8037c31 100644
--- a/parameter/LinearParameterAdaptation.h
+++ b/parameter/LinearParameterAdaptation.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -37,6 +37,7 @@ class CLinearParameterAdaptation : public CParameterAdaptation
{
public:
CLinearParameterAdaptation();
+ CLinearParameterAdaptation(const std::string& strType);
// Conversions
virtual int64_t fromUserValue(double dValue) const;
diff --git a/parameter/LogarithmicParameterAdaptation.cpp b/parameter/LogarithmicParameterAdaptation.cpp
new file mode 100644
index 0000000..688527d
--- /dev/null
+++ b/parameter/LogarithmicParameterAdaptation.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2011-2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "LogarithmicParameterAdaptation.h"
+#include <math.h>
+
+#define base CLinearParameterAdaptation
+
+// M_E is the base of the natural logarithm for 'e' from math.h
+CLogarithmicParameterAdaptation::CLogarithmicParameterAdaptation() : base("Logarithmic"),
+ _dLogarithmBase(M_E), _dFloorValue(-INFINITY)
+{
+}
+
+// Element properties
+void CLogarithmicParameterAdaptation::showProperties(std::string& strResult) const
+{
+ base::showProperties(strResult);
+
+ strResult += " - LogarithmBase: ";
+ strResult += toString(_dLogarithmBase);
+ strResult += "\n";
+ strResult += " - FloorValue: ";
+ strResult += toString(_dFloorValue);
+ strResult += "\n";
+}
+
+bool CLogarithmicParameterAdaptation::fromXml(const CXmlElement& xmlElement,
+ CXmlSerializingContext& serializingContext)
+{
+
+ if (xmlElement.hasAttribute("LogarithmBase")) {
+
+ _dLogarithmBase = xmlElement.getAttributeDouble("LogarithmBase");
+
+ // Avoid negative and 1 values
+ if (_dLogarithmBase <= 0 || _dLogarithmBase == 1) {
+ serializingContext.setError("LogarithmBase attribute cannot be negative or 1 on element"
+ + xmlElement.getPath());
+
+ return false;
+ }
+ }
+
+ if (xmlElement.hasAttribute("FloorValue")) {
+ _dFloorValue = xmlElement.getAttributeDouble("FloorValue");
+ }
+ // Base
+ return base::fromXml(xmlElement, serializingContext);
+}
+
+
+int64_t CLogarithmicParameterAdaptation::fromUserValue(double dValue) const
+{
+ return fmax(round(base::fromUserValue(log(dValue) / log(_dLogarithmBase))),
+ _dFloorValue);
+}
+
+double CLogarithmicParameterAdaptation::toUserValue(int64_t iValue) const
+{
+ return exp(base::toUserValue(iValue) * log(_dLogarithmBase));
+}
diff --git a/parameter/LogarithmicParameterAdaptation.h b/parameter/LogarithmicParameterAdaptation.h
new file mode 100644
index 0000000..3b7fd4d
--- /dev/null
+++ b/parameter/LogarithmicParameterAdaptation.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2011-2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "LinearParameterAdaptation.h"
+
+/**
+ * This class is used to perform a logarithmic adapation of type:
+ * (slopeNumerator / slopeDenominator) * log(parameter) + offset
+ * Since log(x) == -INFINITY , we can define FloorValue as a
+ * x -> 0
+ * a lower bound limit for the adaptation
+ */
+class CLogarithmicParameterAdaptation : public CLinearParameterAdaptation
+{
+public:
+ CLogarithmicParameterAdaptation();
+
+ /**
+ * Conversions must satisfy the following: f(f'(a)) = a
+ * Let f=fromUserValue and f'=toUserValue
+ * if y = f(log(x)/log(base)), then
+ * f'(y) * log(base) = log (x)
+ * exp(f'(y)*log(base)) = x
+ */
+ virtual int64_t fromUserValue(double dValue) const;
+ virtual double toUserValue(int64_t iValue) const;
+
+ virtual void showProperties(std::string& strResult) const;
+
+ virtual bool fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
+private:
+ /**
+ * _dLogarithmBase characterizes the new logarithm logB(x) with
+ * the following property: logB(x) = log(x) / log(_dLogarithmBase).
+ * log being the base-e logarithm.
+ */
+ double _dLogarithmBase;
+ /**
+ * _dFloorValue reflects the lower bound for volume attenuation
+ */
+ double _dFloorValue;
+};
diff --git a/parameter/ParameterAccessContext.cpp b/parameter/ParameterAccessContext.cpp
index bbbbd22..e228d9b 100644
--- a/parameter/ParameterAccessContext.cpp
+++ b/parameter/ParameterAccessContext.cpp
@@ -98,7 +98,7 @@ void CParameterAccessContext::setOutputRawFormat(bool bIsHex)
_bOutputRawFormatIsHex = bIsHex;
}
-bool CParameterAccessContext::outputRawFormatIsHex()
+bool CParameterAccessContext::outputRawFormatIsHex() const
{
return _bOutputRawFormatIsHex;
}
diff --git a/parameter/ParameterAccessContext.h b/parameter/ParameterAccessContext.h
index b59debb..302f920 100644
--- a/parameter/ParameterAccessContext.h
+++ b/parameter/ParameterAccessContext.h
@@ -57,9 +57,20 @@ public:
void setValueSpaceRaw(bool bIsRaw);
bool valueSpaceIsRaw() const;
- // Output Raw Format for user get value interpretation
+ /**
+ * Assigns Output Raw Format for user get value interpretation.
+ *
+ * @param[in] bIsHex "true" for hexadecimal, "false" for decimal
+ *
+ */
void setOutputRawFormat(bool bIsHex);
- bool outputRawFormatIsHex();
+ /**
+ * Returns Output Raw Format for user get value interpretation.
+ *
+ * @return "true" for hexadecimal, "false" for decimal
+ *
+ */
+ bool outputRawFormatIsHex() const;
// Endianness
void setBigEndianSubsystem(bool bBigEndian);
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 4b8bdf6..fb09a7f 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -79,6 +79,7 @@
#include <assert.h>
#include "ParameterHandle.h"
#include "LinearParameterAdaptation.h"
+#include "LogarithmicParameterAdaptation.h"
#include "EnumValuePair.h"
#include "Subsystem.h"
#include "XmlFileDocSink.h"
@@ -87,8 +88,11 @@
#include "XmlStringDocSource.h"
#include "XmlMemoryDocSink.h"
#include "XmlMemoryDocSource.h"
+#include "SelectionCriteriaDefinition.h"
#include "Utility.h"
#include <sstream>
+#include <algorithm>
+#include <ctype.h>
#include <memory>
#define base CElement
@@ -160,7 +164,7 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandPa
/// Criteria
{ "listCriteria", &CParameterMgr::listCriteriaCommmandProcess, 0,
- "[csv]", "List selection criteria" },
+ "[CSV|XML]", "List selection criteria" },
/// Domains
{ "listDomains", &CParameterMgr::listDomainsCommmandProcess, 0,
@@ -300,7 +304,7 @@ CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) :
_pElementLibrarySet(new CElementLibrarySet),
_strXmlConfigurationFilePath(strConfigurationFilePath),
_pSubsystemPlugins(NULL),
- _handleLibRemoteProcessor(NULL),
+ _pvLibRemoteProcessorHandle(NULL),
_uiStructureChecksum(0),
_pRemoteProcessorServer(NULL),
_uiMaxCommandUsageLength(0),
@@ -358,8 +362,9 @@ CParameterMgr::~CParameterMgr()
delete _pElementLibrarySet;
// Close remote processor library
- if (_handleLibRemoteProcessor != NULL) {
- dlclose(_handleLibRemoteProcessor);
+ if (_pvLibRemoteProcessorHandle) {
+
+ dlclose(_pvLibRemoteProcessorHandle);
}
// Tuning Mode Mutex
@@ -454,6 +459,12 @@ bool CParameterMgr::load(string& strError)
return false;
}
+ // Init flow of element tree
+ if (!init(strError)) {
+
+ return false;
+ }
+
// Back synchronization for areas in parameter blackboard not covered by any domain
CBackSynchronizer* pBackSynchronizer = createBackSynchronizer();
@@ -1076,28 +1087,53 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::syncCommmandProcess
/// Criteria
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listCriteriaCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- (void)remoteCommand;
+ if (remoteCommand.getArgumentCount() > 1) {
+
+ return CCommandHandler::EShowUsage;
+ }
- bool humanReadable = true;
+ string strOutputFormat;
// Look for optional arguments
- if (remoteCommand.getArgumentCount() >= 1) {
+ if (remoteCommand.getArgumentCount() == 1) {
+
+ // Get requested format
+ strOutputFormat = remoteCommand.getArgument(0);
+
+ // Capitalize
+ std::transform(strOutputFormat.begin(), strOutputFormat.end(), strOutputFormat.begin(), ::toupper);
+
+ if (strOutputFormat != "XML" && strOutputFormat != "CSV") {
- // If csv is provided, format the criterion list in Commas Separated Value pairs
- if (remoteCommand.getArgument(0) == "csv") {
- humanReadable = false;
- } else {
return CCommandHandler::EShowUsage;
}
}
- list<string> lstrResult;
- getSelectionCriteria()->listSelectionCriteria(lstrResult, true, humanReadable);
+ if (strOutputFormat == "XML") {
+ // Get Root element where to export from
+ const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition = getConstSelectionCriteria()->getSelectionCriteriaDefinition();
- // Concatenate the criterion list as the command result
- CUtility::asString(lstrResult, strResult);
+ if (!exportElementToXMLString(pSelectionCriteriaDefinition, "SelectionCriteria",
+ strResult)) {
- return CCommandHandler::ESucceeded;
+ return CCommandHandler::EFailed;
+ }
+
+ // Succeeded
+ return CCommandHandler::ESucceeded;
+ } else {
+
+ // Requested format will be either CSV or human readable based on strOutputFormat content
+ bool bHumanReadable = strOutputFormat.empty();
+
+ list<string> lstrResult;
+ getSelectionCriteria()->listSelectionCriteria(lstrResult, true, bHumanReadable);
+
+ // Concatenate the criterion list as the command result
+ CUtility::asString(lstrResult, strResult);
+
+ return CCommandHandler::ESucceeded;
+ }
}
/// Domains
@@ -1639,7 +1675,10 @@ CParameterMgr::CCommandHandler::CommandStatus
{
(void)remoteCommand;
- if (!getSystemClassXMLString(strResult)) {
+ // Get Root element where to export from
+ const CSystemClass* pSystemClass = getSystemClass();
+
+ if (!exportElementToXMLString(pSystemClass, pSystemClass->getKind(), strResult)) {
return CCommandHandler::EFailed;
}
@@ -2409,6 +2448,7 @@ void CParameterMgr::feedElementLibraries()
pParameterCreationLibrary->addElementBuilder("BooleanParameter", new TNamedElementBuilderTemplate<CBooleanParameterType>());
pParameterCreationLibrary->addElementBuilder("IntegerParameter", new TNamedElementBuilderTemplate<CIntegerParameterType>());
pParameterCreationLibrary->addElementBuilder("LinearAdaptation", new TElementBuilderTemplate<CLinearParameterAdaptation>());
+ pParameterCreationLibrary->addElementBuilder("LogarithmicAdaptation", new TElementBuilderTemplate<CLogarithmicParameterAdaptation>());
pParameterCreationLibrary->addElementBuilder("EnumParameter", new TNamedElementBuilderTemplate<CEnumParameterType>());
pParameterCreationLibrary->addElementBuilder("ValuePair", new TElementBuilderTemplate<CEnumValuePair>());
pParameterCreationLibrary->addElementBuilder("FixedPointParameter", new TNamedElementBuilderTemplate<CFixedPointParameterType>());
@@ -2453,9 +2493,9 @@ bool CParameterMgr::handleRemoteProcessingInterface(string& strError)
log_info("Loading remote processor library");
// Load library
- _handleLibRemoteProcessor = dlopen("libremote-processor.so", RTLD_NOW);
+ _pvLibRemoteProcessorHandle = dlopen("libremote-processor.so", RTLD_NOW);
- if (!_handleLibRemoteProcessor) {
+ if (!_pvLibRemoteProcessorHandle) {
// Return error
const char* pcError = dlerror();
@@ -2471,7 +2511,7 @@ bool CParameterMgr::handleRemoteProcessingInterface(string& strError)
return false;
}
- CreateRemoteProcessorServer pfnCreateRemoteProcessorServer = (CreateRemoteProcessorServer)dlsym(_handleLibRemoteProcessor, "createRemoteProcessorServer");
+ CreateRemoteProcessorServer pfnCreateRemoteProcessorServer = (CreateRemoteProcessorServer)dlsym(_pvLibRemoteProcessorHandle, "createRemoteProcessorServer");
if (!pfnCreateRemoteProcessorServer) {
@@ -2574,28 +2614,27 @@ void CParameterMgr::doApplyConfigurations(bool bForce)
getSelectionCriteria()->resetModifiedStatus();
}
-bool CParameterMgr::getSystemClassXMLString(string& strResult)
+// Export to XML string
+bool CParameterMgr::exportElementToXMLString(const IXmlSource* pXmlSource,
+ const string& strRootElementType,
+ string& strResult) const
{
- // Root element
- const CSystemClass* pSystemClass = getSystemClass();
-
string strError;
CXmlSerializingContext xmlSerializingContext(strError);
// Use a doc source by loading data from instantiated Configurable Domains
- CXmlMemoryDocSource memorySource(pSystemClass, pSystemClass->getKind(),
- _bValidateSchemasOnStart);
+ CXmlMemoryDocSource memorySource(pXmlSource, strRootElementType, false);
// Use a doc sink that write the doc data in a string
CXmlStringDocSink stringSink(strResult);
+ // Do the export
bool bProcessSuccess = stringSink.process(memorySource, xmlSerializingContext);
if (!bProcessSuccess) {
strResult = strError;
-
}
return bProcessSuccess;
diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h
index c6a2fd5..6a3ecb8 100644
--- a/parameter/ParameterMgr.h
+++ b/parameter/ParameterMgr.h
@@ -88,7 +88,7 @@ class CParameterMgr : private CElement
};
// Version
static const uint32_t guiEditionMajor = 0x2;
- static const uint32_t guiEditionMinor = 0x3;
+ static const uint32_t guiEditionMinor = 0x4;
static const uint32_t guiRevision = 0x0;
// Parameter handle friendship
@@ -340,14 +340,17 @@ public:
bool exportDomainsBinary(const std::string& strFileName, std::string& strError);
/**
- * Method that creates an Xml description of the instanciated parameter structure contained
- * in SystemClass.
+ * Method that exports an Xml description of the passed element into a string
*
- * @param[out] strResult contains the xml description of SystemClass or the errors if any
+ * @param[in] pXmlSource The source element to export
+ * @param[in] strRootElementType The XML root element name of the exported instance document
+ * @param[out] strResult contains the xml description or the error description in case false is returned
*
- * @return false if any error occures during the creation of the xml description
+ * @return true for success, false if any error occurs during the creation of the xml description (validation or encoding)
*/
- bool getSystemClassXMLString(std::string& strResult);
+ bool exportElementToXMLString(const IXmlSource* pXmlSource,
+ const std::string& strRootElementType,
+ std::string& strResult) const;
// CElement
virtual std::string getKind() const;
@@ -597,8 +600,10 @@ private:
// Subsystem plugin location
const CSubsystemPlugins* _pSubsystemPlugins;
- // Remote processor library handle
- void *_handleLibRemoteProcessor;
+ /**
+ * Remote processor library handle
+ */
+ void* _pvLibRemoteProcessorHandle;
// Whole system structure checksum
uint8_t _uiStructureChecksum;
diff --git a/parameter/ParameterMgrFullConnector.cpp b/parameter/ParameterMgrFullConnector.cpp
index b03facc..30f31e9 100644
--- a/parameter/ParameterMgrFullConnector.cpp
+++ b/parameter/ParameterMgrFullConnector.cpp
@@ -363,8 +363,3 @@ bool CParameterMgrFullConnector::exportSingleDomainXml(string& strXmlDest,
return _pParameterMgr->exportSingleDomainXml(strXmlDest, strDomainName, bWithSettings, bToFile,
strError);
}
-
-bool CParameterMgrFullConnector::getSystemClassXMLString(string& strResult)
-{
- return _pParameterMgr->getSystemClassXMLString(strResult);
-}
diff --git a/parameter/ParameterMgrPlatformConnector.cpp b/parameter/ParameterMgrPlatformConnector.cpp
index f29c8a8..d49003d 100644
--- a/parameter/ParameterMgrPlatformConnector.cpp
+++ b/parameter/ParameterMgrPlatformConnector.cpp
@@ -175,12 +175,6 @@ bool CParameterMgrPlatformConnector::start(string& strError)
return false;
}
- // Init flow
- if (!_pParameterMgr->init(strError)) {
-
- return false;
- }
-
_bStarted = true;
return true;
diff --git a/parameter/ParameterType.cpp b/parameter/ParameterType.cpp
index 01d94aa..01d94aa 100755..100644
--- a/parameter/ParameterType.cpp
+++ b/parameter/ParameterType.cpp
diff --git a/parameter/ParameterType.h b/parameter/ParameterType.h
index 7d7caf7..7d7caf7 100755..100644
--- a/parameter/ParameterType.h
+++ b/parameter/ParameterType.h
diff --git a/parameter/SelectionCriterion.cpp b/parameter/SelectionCriterion.cpp
index f49137b..7818924 100644
--- a/parameter/SelectionCriterion.cpp
+++ b/parameter/SelectionCriterion.cpp
@@ -27,6 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#include "SelectionCriterion.h"
#include "AutoLog.h"
@@ -168,3 +169,15 @@ std::string CSelectionCriterion::getFormattedDescription(bool bWithTypeInfo, boo
}
return strFormattedDescription;
}
+
+// XML export
+void CSelectionCriterion::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
+{
+ // Current Value
+ xmlElement.setAttributeString("Value", _pType->getFormattedState(_iState));
+
+ // Serialize Type node
+ _pType->toXml(xmlElement, serializingContext);
+
+ base::toXml(xmlElement, serializingContext);
+}
diff --git a/parameter/SelectionCriterion.h b/parameter/SelectionCriterion.h
index c61d7d0..cf99035 100644
--- a/parameter/SelectionCriterion.h
+++ b/parameter/SelectionCriterion.h
@@ -63,6 +63,15 @@ public:
/// From CElement
virtual std::string getKind() const;
+
+ /**
+ * Export to XML
+ *
+ * @param[in] xmlElement The XML element to export to
+ * @param[in] serializingContext The serializing context
+ *
+ */
+ virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
private:
// Current state
int _iState;
diff --git a/parameter/SelectionCriterionType.cpp b/parameter/SelectionCriterionType.cpp
index 3e9cc80..95e8e46 100644
--- a/parameter/SelectionCriterionType.cpp
+++ b/parameter/SelectionCriterionType.cpp
@@ -203,3 +203,26 @@ std::string CSelectionCriterionType::getFormattedState(int iValue) const
return strFormattedState;
}
+
+// From IXmlSource
+void CSelectionCriterionType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
+{
+ // Type Kind
+ xmlElement.setAttributeString("Kind", isTypeInclusive() ? "Inclusive" : "Exclusive");
+
+ // Value pairs as children
+ NumToLitMapConstIt it;
+
+ for (it = _numToLitMap.begin(); it != _numToLitMap.end(); ++it) {
+
+ CXmlElement childValuePairElement;
+
+ xmlElement.createChild(childValuePairElement, "ValuePair");
+ // Literal
+ childValuePairElement.setAttributeString("Literal", it->first);
+ // Numerical
+ childValuePairElement.setAttributeSignedInteger("Numerical", it->second);
+ }
+
+ base::toXml(xmlElement, serializingContext);
+}
diff --git a/parameter/SelectionCriterionType.h b/parameter/SelectionCriterionType.h
index bfef21e..ef4176a 100644
--- a/parameter/SelectionCriterionType.h
+++ b/parameter/SelectionCriterionType.h
@@ -63,6 +63,15 @@ public:
// Formatted state
virtual std::string getFormattedState(int iValue) const;
+ /**
+ * Export to XML
+ *
+ * @param[in] xmlElement The XML element to export to
+ * @param[in] serializingContext The serializing context
+ *
+ */
+ virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
+
// From CElement
virtual std::string getKind() const;
private:
diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp
index 76b9549..76b9549 100755..100644
--- a/parameter/SubsystemObject.cpp
+++ b/parameter/SubsystemObject.cpp
diff --git a/parameter/SubsystemObject.h b/parameter/SubsystemObject.h
index ab085bc..ab085bc 100755..100644
--- a/parameter/SubsystemObject.h
+++ b/parameter/SubsystemObject.h
diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp
index effc573..334772a 100644
--- a/parameter/SystemClass.cpp
+++ b/parameter/SystemClass.cpp
@@ -71,11 +71,16 @@ CSystemClass::~CSystemClass()
{
delete _pSubsystemLibrary;
- // Close all previously opened libraries
- while (!_subsystemLibraries.empty())
- {
- dlclose(_subsystemLibraries.back());
- _subsystemLibraries.pop_back();
+ // Destroy child subsystems *before* unloading the libraries (otherwise crashes will occur
+ // as unmapped code will be referenced)
+ clean();
+
+ // Close all previously opened subsystem libraries
+ list<void*>::const_iterator it;
+
+ for (it = _subsystemLibraryHandleList.begin(); it != _subsystemLibraryHandleList.end(); ++it) {
+
+ dlclose(*it);
}
}
@@ -238,7 +243,7 @@ bool CSystemClass::loadPlugins(list<string>& lstrPluginFiles, list<string>& lstr
}
// Store libraries handles
- _subsystemLibraries.push_back(lib_handle);
+ _subsystemLibraryHandleList.push_back(lib_handle);
// Get plugin symbol
string strPluginSymbol = getPluginSymbol(strPluginFileName);
@@ -309,12 +314,3 @@ bool CSystemClass::init(string& strError)
{
return base::init(strError);
}
-
-// From IXmlSource
-void CSystemClass::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
-{
- // Set the name of system class
- xmlElement.setNameAttribute(getName());
-
- base::toXml(xmlElement, serializingContext);
-}
diff --git a/parameter/SystemClass.h b/parameter/SystemClass.h
index 3ffbf25..a224609 100644
--- a/parameter/SystemClass.h
+++ b/parameter/SystemClass.h
@@ -75,9 +75,6 @@ public:
virtual bool init(std::string& strError);
virtual std::string getKind() const;
- // From IXmlSource
- virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
-
private:
CSystemClass(const CSystemClass&);
CSystemClass& operator=(const CSystemClass&);
@@ -111,6 +108,6 @@ private:
// Subsystem factory
CSubsystemLibrary* _pSubsystemLibrary;
- std::list<void*> _subsystemLibraries; /**< Contains the list of all open plugin libs. */
+ std::list<void*> _subsystemLibraryHandleList; /**< Contains the list of all open plugin libs. */
};
diff --git a/parameter/TypeElement.cpp b/parameter/TypeElement.cpp
index 7e58c75..7e58c75 100755..100644
--- a/parameter/TypeElement.cpp
+++ b/parameter/TypeElement.cpp
diff --git a/parameter/TypeElement.h b/parameter/TypeElement.h
index 8f474c0..8f474c0 100755..100644
--- a/parameter/TypeElement.h
+++ b/parameter/TypeElement.h
diff --git a/parameter/include/ParameterMgrFullConnector.h b/parameter/include/ParameterMgrFullConnector.h
index 8ef7bb7..31022a6 100644
--- a/parameter/include/ParameterMgrFullConnector.h
+++ b/parameter/include/ParameterMgrFullConnector.h
@@ -259,16 +259,6 @@ public:
bool exportSingleDomainXml(std::string& strXmlDest, const std::string& strDomainName, bool bWithSettings,
bool bToFile, std::string& strError) const;
- /**
- * Method that creates an Xml description of the instanciated parameter structure contained
- * in SystemClass.
- *
- * @param[out] strResult contains the xml description of SystemClass or the errors if any
- *
- * @return false if any error occures during the creation of the xml description
- */
- bool getSystemClassXMLString(std::string& strResult);
-
private:
// disallow copying because this class manages raw pointers' lifecycle
CParameterMgrFullConnector(const CParameterMgrFullConnector&);