From d39b189e045353199ad852aaf2816c93864c7e88 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 6 Jan 2015 14:52:49 +0100 Subject: ParameterMgr: Add more tuning methods to the C++ public API These methods are: - renameDomain - setSequenceAwareness - getSequenceAwareness - renameConfiguration - setElementSequence - setApplicationRule - getApplicationRule - clearApplicationRule The "remote tuning" methods are also modified to use them instead of directly accessing inner objects and the tuning mode checking is moved to the public C++ method when applicable. Change-Id: I9cdd0abbacb76232cd746878dca9ab619e8b6b58 Signed-off-by: David Wagner --- parameter/ParameterMgr.cpp | 103 ++++++++++++++++++++++++++++++++++++--------- parameter/ParameterMgr.h | 17 ++++++++ 2 files changed, 100 insertions(+), 20 deletions(-) (limited to 'parameter') diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index 84a3fd4..1f38c50 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -1118,17 +1118,12 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteAllDomainsCom CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) { - return getConfigurableDomains()->renameDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; + return renameDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? + CCommandHandler::EDone : CCommandHandler::EFailed; } CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) { - // Check tuning mode - if (!checkTuningModeOn(strResult)) { - - return CCommandHandler::EFailed; - } - // Set property bool bSequenceAware; @@ -1145,7 +1140,8 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenes return CCommandHandler::EShowUsage; } - return getConfigurableDomains()->setSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; + return setSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult) ? + CCommandHandler::EDone : CCommandHandler::EFailed; } CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) @@ -1153,7 +1149,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenes // Get property bool bSequenceAware; - if (!getConfigurableDomains()->getSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult)) { + if (!getSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult)) { return CCommandHandler::EFailed; } @@ -1215,7 +1211,9 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteConfiguration CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) { - return getConfigurableDomains()->renameConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), remoteCommand.getArgument(2), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; + return renameConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), + remoteCommand.getArgument(2), strResult) ? + CCommandHandler::EDone : CCommandHandler::EFailed; } CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::saveConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) @@ -1237,12 +1235,6 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::restoreConfiguratio CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) { - // Check tuning mode - if (!checkTuningModeOn(strResult)) { - - return CCommandHandler::EFailed; - } - // Build configurable element path list std::vector astrNewElementSequence; @@ -1254,7 +1246,9 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceC } // Delegate to configurable domains - return getConfigurableDomains()->setElementSequence(remoteCommand.getArgument(0), remoteCommand.getArgument(1), astrNewElementSequence, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; + return setElementSequence(remoteCommand.getArgument(0), remoteCommand.getArgument(1), + astrNewElementSequence, strResult) ? + CCommandHandler::EDone : CCommandHandler::EFailed; } CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) @@ -1266,19 +1260,25 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSequenceC CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) { // Delegate to configurable domains - return getConfigurableDomains()->setApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), remoteCommand.packArguments(2, remoteCommand.getArgumentCount() - 2), getConstSelectionCriteria()->getSelectionCriteriaDefinition(), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; + return setApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), + remoteCommand.packArguments(2, remoteCommand.getArgumentCount() - 2), strResult) ? + CCommandHandler::EDone : CCommandHandler::EFailed; } CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::clearRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) { // Delegate to configurable domains - return getConfigurableDomains()->clearApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; + return clearApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), + strResult) ? + CCommandHandler::EDone : CCommandHandler::EFailed; } CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) { // Delegate to configurable domains - return getConfigurableDomains()->getApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed; + return getApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), + strResult) ? + CCommandHandler::ESucceeded : CCommandHandler::EFailed; } /// Elements/Parameters @@ -1934,6 +1934,12 @@ bool CParameterMgr::deleteDomain(const string& strName, string& strError) return getConfigurableDomains()->deleteDomain(strName, strError); } +bool CParameterMgr::renameDomain(const string& strName, const string& strNewName, string& strError) +{ + // Delegate to configurable domains + return getConfigurableDomains()->renameDomain(strName, strNewName, strError); +} + bool CParameterMgr::deleteAllDomains(string& strError) { // Check tuning mode @@ -1948,6 +1954,23 @@ bool CParameterMgr::deleteAllDomains(string& strError) return true; } +bool CParameterMgr::setSequenceAwareness(const string& strName, bool bSequenceAware, string& strResult) +{ + // Check tuning mode + if (!checkTuningModeOn(strResult)) { + + return false; + } + + return getConfigurableDomains()->setSequenceAwareness(strName, bSequenceAware, strResult); +} + +bool CParameterMgr::getSequenceAwareness(const string& strName, bool& bSequenceAware, + string& strResult) +{ + return getConfigurableDomains()->getSequenceAwareness(strName, bSequenceAware, strResult); +} + bool CParameterMgr::createConfiguration(const string& strDomain, const string& strConfiguration, string& strError) { // Check tuning mode @@ -1959,6 +1982,12 @@ bool CParameterMgr::createConfiguration(const string& strDomain, const string& s // Delegate to configurable domains return getConfigurableDomains()->createConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, strError); } +bool CParameterMgr::renameConfiguration(const string& strDomain, const string& strConfiguration, + const string& strNewConfiguration, string& strError) +{ + return getConfigurableDomains()->renameConfiguration(strDomain, strConfiguration, + strNewConfiguration, strError); +} bool CParameterMgr::deleteConfiguration(const string& strDomain, const string& strConfiguration, string& strError) { @@ -2071,6 +2100,40 @@ bool CParameterMgr::split(const string& strDomain, const string& strConfigurable return getConfigurableDomains()->split(strDomain, pConfigurableElement, strError); } +bool CParameterMgr::setElementSequence(const string& strDomain, const string& strConfiguration, + const std::vector& astrNewElementSequence, + string& strError) +{ + // Check tuning mode + if (!checkTuningModeOn(strError)) { + + return false; + } + + return getConfigurableDomains()->setElementSequence(strDomain, strConfiguration, + astrNewElementSequence, strError); +} + +bool CParameterMgr::getApplicationRule(const string& strDomain, const string& strConfiguration, + string& strResult) +{ + return getConfigurableDomains()->getApplicationRule(strDomain, strConfiguration, strResult); +} + +bool CParameterMgr::setApplicationRule(const string& strDomain, const string& strConfiguration, + const string& strApplicationRule, string& strError) +{ + return getConfigurableDomains()->setApplicationRule(strDomain, strConfiguration, + strApplicationRule, getConstSelectionCriteria()->getSelectionCriteriaDefinition(), + strError); +} + +bool CParameterMgr::clearApplicationRule(const string& strDomain, const string& strConfiguration, + string& strError) +{ + return getConfigurableDomains()->clearApplicationRule(strDomain, strConfiguration, strError); +} + bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSettings, bool bFromFile, string& strError) { diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h index 7962294..fcba462 100644 --- a/parameter/ParameterMgr.h +++ b/parameter/ParameterMgr.h @@ -221,10 +221,17 @@ public: ////////// Configuration/Domains handling ////////////// // Creation/Deletion bool createDomain(const std::string& strName, std::string& strError); + bool renameDomain(const std::string& strName, const std::string& strNewName, + std::string& strError); bool deleteDomain(const std::string& strName, std::string& strError); bool deleteAllDomains(std::string& strError); + bool setSequenceAwareness(const std::string& strName, bool bSequenceAware, + std::string& strResult); + bool getSequenceAwareness(const std::string& strName, bool& bSequenceAware, + std::string& strResult); bool createConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError); bool deleteConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError); + bool renameConfiguration(const std::string& strDomain, const std::string& strConfiguration, const std::string& strNewConfiguration, std::string& strError); // Save/Restore bool restoreConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::list& strError); @@ -234,6 +241,16 @@ public: bool addConfigurableElementToDomain(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError); bool removeConfigurableElementFromDomain(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError); bool split(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError); + bool setElementSequence(const std::string& strDomain, const std::string& strConfiguration, + const std::vector& astrNewElementSequence, + std::string& strError); + + bool getApplicationRule(const std::string& strDomain, const std::string& strConfiguration, + std::string& strResult); + bool setApplicationRule(const std::string& strDomain, const std::string& strConfiguration, + const std::string& strApplicationRule, std::string& strError); + bool clearApplicationRule(const std::string& strDomain, const std::string& strConfiguration, + std::string& strError); /** * Method that imports Configurable Domains from an Xml source. -- cgit v1.1 From 4832db35864949f0792087f82babe353223c173b Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 6 Jan 2015 14:57:57 +0100 Subject: ParameterMgr: fix some return values types Some public methods returned a "CCommandHandler" enum value type, which is intended to be used in the remote tuning methods only. Primitive bools must be used instead. Change-Id: Iac7a565f701c65875b3f1dd0896bf31d7d843d72 Signed-off-by: David Wagner --- parameter/ParameterMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'parameter') diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index 1f38c50..9e2abed 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -2066,7 +2066,7 @@ bool CParameterMgr::removeConfigurableElementFromDomain(const string& strDomain, if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) { - return CCommandHandler::EFailed; + return false; } // Convert element @@ -2090,7 +2090,7 @@ bool CParameterMgr::split(const string& strDomain, const string& strConfigurable if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) { - return CCommandHandler::EFailed; + return false; } // Convert element -- cgit v1.1 From 17d59220b9517963bbe27c450207e3c0a43443fb Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 6 Jan 2015 17:05:35 +0100 Subject: ParameterMgr: remove some dead code logStructureContent() wasn't called by anybody. Change-Id: I152b6f1790a545ab302ca90389c78c43a0bb6056 Signed-off-by: David Wagner --- parameter/ParameterMgr.cpp | 10 ---------- parameter/ParameterMgr.h | 3 --- 2 files changed, 13 deletions(-) (limited to 'parameter') diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index 9e2abed..edf8080 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -1899,16 +1899,6 @@ bool CParameterMgr::sync(string& strError) return true; } -// Content dump -void CParameterMgr::logStructureContent(string& strContent) const -{ - string strError; - - CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex); - - dumpContent(strContent, parameterAccessContext); -} - // Configuration/Domains handling bool CParameterMgr::createDomain(const string& strName, string& strError) { diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h index fcba462..7ce19a5 100644 --- a/parameter/ParameterMgr.h +++ b/parameter/ParameterMgr.h @@ -354,9 +354,6 @@ public: */ bool getSystemClassXMLString(std::string& strResult); - // Introspect - void logStructureContent(std::string& strContent) const; - // CElement virtual std::string getKind() const; -- cgit v1.1 From 873db82f0fe7b54386d5cc26dec6737e0446d93d Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 6 Jan 2015 17:23:48 +0100 Subject: ParameterMgr: enforce Tuning Mode on write access of parameters This applies only to setParameter: this commands should only be available in Tuning Mode. This is enforced by moving the tuning mode check from the remote interface to the internal CParameterMgr::accessParameterValue() method. Additionaly, CParameterMgr::accessValue is made private. Change-Id: I189362a768ce1cd9709b6e5d48cd833f7ca56479 Signed-off-by: David Wagner --- parameter/ParameterMgr.cpp | 11 ++++++----- parameter/ParameterMgr.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'parameter') diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index edf8080..b81243d 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -1414,11 +1414,6 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getParameterCommman CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) { - // Check tuning mode - if (!checkTuningModeOn(strResult)) { - - return CCommandHandler::EFailed; - } // Get value to set string strValue = remoteCommand.packArguments(1, remoteCommand.getArgumentCount() - 1); @@ -1644,6 +1639,12 @@ CParameterMgr::CCommandHandler::CommandStatus // User set/get parameters in main BlackBoard bool CParameterMgr::accessParameterValue(const string& strPath, string& strValue, bool bSet, string& strError) { + // Forbid write access when not in TuningMode + if (bSet && !checkTuningModeOn(strError)) { + + return false; + } + // Define context CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex); diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h index 7ce19a5..5fd41b1 100644 --- a/parameter/ParameterMgr.h +++ b/parameter/ParameterMgr.h @@ -205,7 +205,6 @@ public: bool sync(std::string& strError); // User set/get parameters - bool accessValue(CParameterAccessContext& parameterAccessContext, const std::string& strPath, std::string& strValue, bool bSet, std::string& strError); bool accessParameterValue(const std::string& strPath, std::string& strValue, bool bSet, std::string& strError); /** * Returns the element mapping corresponding to the path given in parameter. @@ -502,6 +501,7 @@ private: CParameterBlackboard* getParameterBlackboard(); // Parameter access + bool accessValue(CParameterAccessContext& parameterAccessContext, const std::string& strPath, std::string& strValue, bool bSet, std::string& strError); bool doSetValue(const std::string& strPath, const std::string& strValue, bool bRawValueSpace, bool bDynamicAccess, std::string& strError) const; bool doGetValue(const std::string& strPath, std::string& strValue, bool bRawValueSpace, bool bHexOutputRawFormat, bool bDynamicAccess, std::string& strError) const; -- cgit v1.1 From 70e458c1bb62ad39ea9c59339e74e1f7702910ee Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 6 Jan 2015 17:26:59 +0100 Subject: ParameterMgr: make serializeElement and importDomainFromFile private methods There is no need for these method to be public as they are only used internaly. Change-Id: I172257211f35de26c11aaef499f7c847d55ced0b Signed-off-by: David Wagner --- parameter/ParameterMgr.h | 55 ++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'parameter') diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h index 5fd41b1..315cf63 100644 --- a/parameter/ParameterMgr.h +++ b/parameter/ParameterMgr.h @@ -282,33 +282,6 @@ public: std::string& strError); /** - * Method that imports a single Configurable Domain, with settings, from an Xml file. - * - * @param[in] strXmlFilePath absolute path to the xml file containing the domain - * @param[out] strError is used as the error output - * - * @return false if any error occurs - */ - bool importDomainFromFile(const std::string& strXmlFilePath, bool bOverwrite, std::string& strError); - - - /** - * Export an element object to an Xml destination. - * - * - * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file. - * @param[in] xmlSerializingContext the serializing context - * @param[in] bToFile a boolean that determines if the destination is an xml description in - * strXmlDest or contained in a file. In that case strXmlDest is just the file path. - * @param[in] element object to be serialized. - * @param[out] strError is used as the error output. - * - * @return false if any error occurs, true otherwise. - */ - bool serializeElement(std::string& strXmlDest, CXmlSerializingContext& xmlSerializingContext, - bool bToFile, const CElement& element, std::string& strError) const; - - /** * Method that exports Configurable Domains to an Xml destination. * * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file @@ -518,6 +491,34 @@ private: // Parse XML file into Root element bool xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const std::string& strXmlFilePath, const std::string& strXmlFolder, ElementLibrary eElementLibrary, const std::string& strNameAttrituteName = "Name"); + /** + * Export an element object to an Xml destination. + * + * + * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file. + * @param[in] xmlSerializingContext the serializing context + * @param[in] bToFile a boolean that determines if the destination is an xml description in + * strXmlDest or contained in a file. In that case strXmlDest is just the file path. + * @param[in] element object to be serialized. + * @param[out] strError is used as the error output. + * + * @return false if any error occurs, true otherwise. + */ + bool serializeElement(std::string& strXmlDest, CXmlSerializingContext& xmlSerializingContext, + bool bToFile, const CElement& element, std::string& strError) const; + + /** + * Method that imports a single Configurable Domain, with settings, from an Xml file. + * + * @param[in] strXmlFilePath absolute path to the xml file containing the domain + * @param[out] strError is used as the error output + * + * @return false if any error occurs + */ + bool importDomainFromFile(const std::string& strXmlFilePath, bool bOverwrite, + std::string& strError); + + // Framework Configuration CParameterFrameworkConfiguration* getFrameworkConfiguration(); const CParameterFrameworkConfiguration* getConstFrameworkConfiguration(); -- cgit v1.1 From d700782e7dae31cbef37ae038b992d2cb0c6f6a4 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 6 Jan 2015 18:27:08 +0100 Subject: Make ParameterMgrLogger template This will make it possible to have different kind of ParameterMgr connectors instead of hardcoding ParameterMgrPlatformConnector in ParameterMgrLogger. Change-Id: Ia78d9f56c8cc73321e1956856755a56a3569b517 Signed-off-by: David Wagner --- parameter/Android.mk | 2 +- parameter/CMakeLists.txt | 3 +- parameter/ParameterMgrLogger.cpp | 44 ----------------------- parameter/ParameterMgrLogger.h | 21 +++++++---- parameter/ParameterMgrPlatformConnector.cpp | 2 +- parameter/include/ParameterMgrLoggerForward.h | 33 +++++++++++++++++ parameter/include/ParameterMgrPlatformConnector.h | 6 ++-- 7 files changed, 53 insertions(+), 58 deletions(-) delete mode 100644 parameter/ParameterMgrLogger.cpp create mode 100644 parameter/include/ParameterMgrLoggerForward.h (limited to 'parameter') diff --git a/parameter/Android.mk b/parameter/Android.mk index aaa40ea..247c745 100644 --- a/parameter/Android.mk +++ b/parameter/Android.mk @@ -34,6 +34,7 @@ LOCAL_PATH := $(call my-dir) common_copy_headers_to := parameter common_copy_headers := \ + include/ParameterMgrLoggerForward.h \ include/ParameterMgrPlatformConnector.h \ include/SelectionCriterionTypeInterface.h \ include/SelectionCriterionInterface.h \ @@ -92,7 +93,6 @@ common_src_files := \ BitParameterType.cpp \ BitParameter.cpp \ ElementLocator.cpp \ - ParameterMgrLogger.cpp \ AutoLog.cpp \ CompoundRule.cpp \ SelectionCriterionRule.cpp \ diff --git a/parameter/CMakeLists.txt b/parameter/CMakeLists.txt index 50fc15b..590c7b1 100644 --- a/parameter/CMakeLists.txt +++ b/parameter/CMakeLists.txt @@ -79,7 +79,6 @@ add_library(parameter SHARED BitParameterType.cpp BitParameter.cpp ElementLocator.cpp - ParameterMgrLogger.cpp AutoLog.cpp CompoundRule.cpp SelectionCriterionRule.cpp @@ -153,7 +152,6 @@ add_library(parameter SHARED BitParameterType.cpp BitParameter.cpp ElementLocator.cpp - ParameterMgrLogger.cpp AutoLog.cpp CompoundRule.cpp SelectionCriterionRule.cpp @@ -189,6 +187,7 @@ install(TARGETS parameter LIBRARY DESTINATION lib) # Client headers install(FILES include/ParameterHandle.h + include/ParameterMgrLoggerForward.h include/ParameterMgrPlatformConnector.h include/SelectionCriterionInterface.h include/SelectionCriterionTypeInterface.h diff --git a/parameter/ParameterMgrLogger.cpp b/parameter/ParameterMgrLogger.cpp deleted file mode 100644 index ddd81ef..0000000 --- a/parameter/ParameterMgrLogger.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2011-2014, 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 "ParameterMgrLogger.h" -#include "ParameterMgrPlatformConnector.h" - - -using std::string; - -CParameterMgrLogger::CParameterMgrLogger(CParameterMgrPlatformConnector *pParameterMgrPlatformConnector) : - _pParameterMgrPlatformConnector(pParameterMgrPlatformConnector) -{ -} - -void CParameterMgrLogger::log(bool bIsWarning, const string &strLog) -{ - _pParameterMgrPlatformConnector->doLog(bIsWarning, strLog); -} diff --git a/parameter/ParameterMgrLogger.h b/parameter/ParameterMgrLogger.h index 5a8dd9d..0e42d8a 100644 --- a/parameter/ParameterMgrLogger.h +++ b/parameter/ParameterMgrLogger.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, @@ -29,22 +29,29 @@ */ #pragma once +#include "ParameterMgrLoggerForward.h" #include "ParameterMgr.h" #include -class CParameterMgrPlatformConnector; - +/* Wrap a class to expose its logging [log(bool, string&)] capabilities + * through ILogger. */ +template class CParameterMgrLogger : public CParameterMgr::ILogger { public: - CParameterMgrLogger(CParameterMgrPlatformConnector* pParameterMgrPlatformConnector); + CParameterMgrLogger(T& parameterMgrConnector) : + _parameterMgrConnector(parameterMgrConnector) + { + } - // Logging - virtual void log(bool bIsWarning, const std::string& strLog); + virtual void log(bool bIsWarning, const std::string& strLog) + { + _parameterMgrConnector.doLog(bIsWarning, strLog); + } private: // Log destination - CParameterMgrPlatformConnector* _pParameterMgrPlatformConnector; + T& _parameterMgrConnector; }; diff --git a/parameter/ParameterMgrPlatformConnector.cpp b/parameter/ParameterMgrPlatformConnector.cpp index b98692c..7a8511b 100644 --- a/parameter/ParameterMgrPlatformConnector.cpp +++ b/parameter/ParameterMgrPlatformConnector.cpp @@ -40,7 +40,7 @@ CParameterMgrPlatformConnector::CParameterMgrPlatformConnector( _pParameterMgr(new CParameterMgr(strConfigurationFilePath)), _bStarted(false), _pLogger(NULL) { // Logging - _pParameterMgrLogger = new CParameterMgrLogger(this); + _pParameterMgrLogger = new CParameterMgrLogger(*this); _pParameterMgr->setLogger(_pParameterMgrLogger); } diff --git a/parameter/include/ParameterMgrLoggerForward.h b/parameter/include/ParameterMgrLoggerForward.h new file mode 100644 index 0000000..28b26db --- /dev/null +++ b/parameter/include/ParameterMgrLoggerForward.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 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 + +// Shared forward declaration, to ensure declaration alignment +template class CParameterMgrLogger; diff --git a/parameter/include/ParameterMgrPlatformConnector.h b/parameter/include/ParameterMgrPlatformConnector.h index d489545..baa0e7e 100644 --- a/parameter/include/ParameterMgrPlatformConnector.h +++ b/parameter/include/ParameterMgrPlatformConnector.h @@ -32,13 +32,13 @@ #include "SelectionCriterionTypeInterface.h" #include "SelectionCriterionInterface.h" #include "ParameterHandle.h" +#include "ParameterMgrLoggerForward.h" class CParameterMgr; -class CParameterMgrLogger; class CParameterMgrPlatformConnector { - friend class CParameterMgrLogger; + friend class CParameterMgrLogger; public: // Logger interface class ILogger @@ -144,5 +144,5 @@ private: // Logging ILogger* _pLogger; // Private logging - CParameterMgrLogger* _pParameterMgrLogger; + CParameterMgrLogger* _pParameterMgrLogger; }; -- cgit v1.1 From a53f6504e8d3d01ffd0ea1e655e202b03b943fe6 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 6 Jan 2015 18:30:49 +0100 Subject: parameter: sort C++ filenames and remove duplicates There were duplicates in the CMakeLists.txt; this patch removes them and sorts the filenames so that they are identical in Android.mk and CMakeLists.txt. Please keep the names sorted, using the shell's "sort -u" command. Change-Id: I027676beb4ee19de2341cd65e0e5c077cddb5627 Signed-off-by: David Wagner --- parameter/Android.mk | 118 +++++++++++++++---------------- parameter/CMakeLists.txt | 179 ++++++++++++++--------------------------------- 2 files changed, 112 insertions(+), 185 deletions(-) (limited to 'parameter') diff --git a/parameter/Android.mk b/parameter/Android.mk index 247c745..0625c2b 100644 --- a/parameter/Android.mk +++ b/parameter/Android.mk @@ -41,79 +41,79 @@ common_copy_headers := \ include/ParameterHandle.h common_src_files := \ - Subsystem.cpp \ - PathNavigator.cpp \ - Element.cpp \ - SystemClass.cpp \ - ParameterMgr.cpp \ - SelectionCriteria.cpp \ - SelectionCriterionLibrary.cpp \ - SelectionCriteriaDefinition.cpp \ - SelectionCriterionType.cpp \ - ElementLibrary.cpp \ - SubsystemElementBuilder.cpp \ - SelectionCriterion.cpp \ + AreaConfiguration.cpp \ + ArrayParameter.cpp \ + AutoLog.cpp \ + BaseParameter.cpp \ + BinarySerializableElement.cpp \ + BinaryStream.cpp \ + BitParameterBlock.cpp \ + BitParameterBlockType.cpp \ + BitParameter.cpp \ + BitParameterType.cpp \ + BitwiseAreaConfiguration.cpp \ + BooleanParameterType.cpp \ + ComponentInstance.cpp \ ComponentLibrary.cpp \ + ComponentType.cpp \ + CompoundRule.cpp \ + ConfigurableDomain.cpp \ + ConfigurableDomains.cpp \ + ConfigurableElementAggregator.cpp \ ConfigurableElement.cpp \ + ConfigurationAccessContext.cpp \ + DomainConfiguration.cpp \ + Element.cpp \ + ElementLibrary.cpp \ + ElementLibrarySet.cpp \ + ElementLocator.cpp \ + EnumParameterType.cpp \ + EnumValuePair.cpp \ + ErrorContext.cpp \ + FixedPointParameterType.cpp \ + FormattedSubsystemObject.cpp \ + FrameworkConfigurationLocation.cpp \ + HardwareBackSynchronizer.cpp \ + InstanceConfigurableElement.cpp \ + InstanceDefinition.cpp \ + IntegerParameterType.cpp \ + LinearParameterAdaptation.cpp \ + MappingContext.cpp \ MappingData.cpp \ + ParameterAccessContext.cpp \ + ParameterAdaptation.cpp \ ParameterBlackboard.cpp \ - ComponentType.cpp \ - TypeElement.cpp \ - InstanceConfigurableElement.cpp \ - ComponentInstance.cpp \ ParameterBlockType.cpp \ - ParameterType.cpp \ Parameter.cpp \ - BooleanParameterType.cpp \ - IntegerParameterType.cpp \ - ArrayParameter.cpp \ - InstanceDefinition.cpp \ - ParameterMgrPlatformConnector.cpp \ - FixedPointParameterType.cpp \ - ParameterAccessContext.cpp \ - XmlFileIncluderElement.cpp \ ParameterFrameworkConfiguration.cpp \ - FrameworkConfigurationLocation.cpp \ + ParameterHandle.cpp \ + ParameterMgr.cpp \ + ParameterMgrPlatformConnector.cpp \ + ParameterType.cpp \ + PathNavigator.cpp \ PluginLocation.cpp \ - ElementLibrarySet.cpp \ - ErrorContext.cpp \ - AreaConfiguration.cpp \ - DomainConfiguration.cpp \ - ConfigurableDomain.cpp \ - SyncerSet.cpp \ - ConfigurableDomains.cpp \ - BinaryStream.cpp \ - ConfigurationAccessContext.cpp \ - XmlElementSerializingContext.cpp \ - XmlParameterSerializingContext.cpp \ - BinarySerializableElement.cpp \ - BitwiseAreaConfiguration.cpp \ - BitParameterBlockType.cpp \ - BitParameterBlock.cpp \ - BitParameterType.cpp \ - BitParameter.cpp \ - ElementLocator.cpp \ - AutoLog.cpp \ - CompoundRule.cpp \ + RuleParser.cpp \ + SelectionCriteria.cpp \ + SelectionCriteriaDefinition.cpp \ + SelectionCriterion.cpp \ + SelectionCriterionLibrary.cpp \ SelectionCriterionRule.cpp \ - ConfigurableElementAggregator.cpp \ - HardwareBackSynchronizer.cpp \ + SelectionCriterionType.cpp \ SimulatedBackSynchronizer.cpp \ - MappingContext.cpp \ + StringParameter.cpp \ + StringParameterType.cpp \ + Subsystem.cpp \ + SubsystemElementBuilder.cpp \ SubsystemObject.cpp \ - FormattedSubsystemObject.cpp \ SubsystemObjectCreator.cpp \ - BaseParameter.cpp \ - StringParameterType.cpp \ - StringParameter.cpp \ - EnumParameterType.cpp \ + SyncerSet.cpp \ + SystemClass.cpp \ + TypeElement.cpp \ VirtualSubsystem.cpp \ VirtualSyncer.cpp \ - ParameterHandle.cpp \ - ParameterAdaptation.cpp \ - LinearParameterAdaptation.cpp \ - RuleParser.cpp \ - EnumValuePair.cpp + XmlElementSerializingContext.cpp \ + XmlFileIncluderElement.cpp \ + XmlParameterSerializingContext.cpp common_module := libparameter common_module_tags := optional diff --git a/parameter/CMakeLists.txt b/parameter/CMakeLists.txt index 590c7b1..cf2449e 100644 --- a/parameter/CMakeLists.txt +++ b/parameter/CMakeLists.txt @@ -27,152 +27,79 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. add_library(parameter SHARED - Subsystem.cpp - PathNavigator.cpp - Element.cpp - SystemClass.cpp - ParameterMgr.cpp - SelectionCriteria.cpp - SelectionCriterionLibrary.cpp - SelectionCriteriaDefinition.cpp - SelectionCriterionType.cpp - ElementLibrary.cpp - SubsystemElementBuilder.cpp - SelectionCriterion.cpp - ComponentLibrary.cpp - ConfigurableElement.cpp - MappingData.cpp - ParameterBlackboard.cpp - ComponentType.cpp - TypeElement.cpp - InstanceConfigurableElement.cpp - ComponentInstance.cpp - ParameterBlockType.cpp - ParameterType.cpp - Parameter.cpp - BooleanParameterType.cpp - IntegerParameterType.cpp - ArrayParameter.cpp - InstanceDefinition.cpp - ParameterMgrPlatformConnector.cpp - FixedPointParameterType.cpp - ParameterAccessContext.cpp - XmlFileIncluderElement.cpp - ParameterFrameworkConfiguration.cpp - FrameworkConfigurationLocation.cpp - PluginLocation.cpp - ElementLibrarySet.cpp - ErrorContext.cpp AreaConfiguration.cpp - DomainConfiguration.cpp - ConfigurableDomain.cpp - SyncerSet.cpp - ConfigurableDomains.cpp - BinaryStream.cpp - ConfigurationAccessContext.cpp - XmlElementSerializingContext.cpp - XmlParameterSerializingContext.cpp + ArrayParameter.cpp + AutoLog.cpp + BaseParameter.cpp BinarySerializableElement.cpp - BitwiseAreaConfiguration.cpp - BitParameterBlockType.cpp + BinaryStream.cpp BitParameterBlock.cpp - BitParameterType.cpp + BitParameterBlockType.cpp BitParameter.cpp - ElementLocator.cpp - AutoLog.cpp + BitParameterType.cpp + BitwiseAreaConfiguration.cpp + BooleanParameterType.cpp + ComponentInstance.cpp + ComponentLibrary.cpp + ComponentType.cpp CompoundRule.cpp - SelectionCriterionRule.cpp + ConfigurableDomain.cpp + ConfigurableDomains.cpp ConfigurableElementAggregator.cpp - HardwareBackSynchronizer.cpp - SimulatedBackSynchronizer.cpp - MappingContext.cpp - SubsystemObject.cpp - FormattedSubsystemObject.cpp - SubsystemObjectCreator.cpp - BaseParameter.cpp - StringParameterType.cpp - StringParameter.cpp - EnumParameterType.cpp - VirtualSubsystem.cpp - VirtualSyncer.cpp - ParameterHandle.cpp - ParameterAdaptation.cpp - LinearParameterAdaptation.cpp - RuleParser.cpp - EnumValuePair.cpp - Subsystem.cpp - PathNavigator.cpp + ConfigurableElement.cpp + ConfigurationAccessContext.cpp + DomainConfiguration.cpp Element.cpp - SystemClass.cpp - ParameterMgr.cpp - SelectionCriteria.cpp - SelectionCriterionLibrary.cpp - SelectionCriteriaDefinition.cpp - SelectionCriterionType.cpp ElementLibrary.cpp - SubsystemElementBuilder.cpp - SelectionCriterion.cpp - ComponentLibrary.cpp - ConfigurableElement.cpp + ElementLibrarySet.cpp + ElementLocator.cpp + EnumParameterType.cpp + EnumValuePair.cpp + ErrorContext.cpp + FixedPointParameterType.cpp + FormattedSubsystemObject.cpp + FrameworkConfigurationLocation.cpp + HardwareBackSynchronizer.cpp + InstanceConfigurableElement.cpp + InstanceDefinition.cpp + IntegerParameterType.cpp + LinearParameterAdaptation.cpp + MappingContext.cpp MappingData.cpp + ParameterAccessContext.cpp + ParameterAdaptation.cpp ParameterBlackboard.cpp - ComponentType.cpp - TypeElement.cpp - InstanceConfigurableElement.cpp - ComponentInstance.cpp ParameterBlockType.cpp - ParameterType.cpp Parameter.cpp - BooleanParameterType.cpp - IntegerParameterType.cpp - ArrayParameter.cpp - InstanceDefinition.cpp - ParameterMgrPlatformConnector.cpp - FixedPointParameterType.cpp - ParameterAccessContext.cpp - XmlFileIncluderElement.cpp ParameterFrameworkConfiguration.cpp - FrameworkConfigurationLocation.cpp + ParameterHandle.cpp + ParameterMgr.cpp + ParameterMgrPlatformConnector.cpp + ParameterType.cpp + PathNavigator.cpp PluginLocation.cpp - ElementLibrarySet.cpp - ErrorContext.cpp - AreaConfiguration.cpp - DomainConfiguration.cpp - ConfigurableDomain.cpp - SyncerSet.cpp - ConfigurableDomains.cpp - BinaryStream.cpp - ConfigurationAccessContext.cpp - XmlElementSerializingContext.cpp - XmlParameterSerializingContext.cpp - BinarySerializableElement.cpp - BitwiseAreaConfiguration.cpp - BitParameterBlockType.cpp - BitParameterBlock.cpp - BitParameterType.cpp - BitParameter.cpp - ElementLocator.cpp - AutoLog.cpp - CompoundRule.cpp + RuleParser.cpp + SelectionCriteria.cpp + SelectionCriteriaDefinition.cpp + SelectionCriterion.cpp + SelectionCriterionLibrary.cpp SelectionCriterionRule.cpp - ConfigurableElementAggregator.cpp - HardwareBackSynchronizer.cpp + SelectionCriterionType.cpp SimulatedBackSynchronizer.cpp - MappingContext.cpp + StringParameter.cpp + StringParameterType.cpp + Subsystem.cpp + SubsystemElementBuilder.cpp SubsystemObject.cpp - FormattedSubsystemObject.cpp SubsystemObjectCreator.cpp - BaseParameter.cpp - StringParameterType.cpp - StringParameter.cpp - EnumParameterType.cpp + SyncerSet.cpp + SystemClass.cpp + TypeElement.cpp VirtualSubsystem.cpp VirtualSyncer.cpp - ParameterHandle.cpp - ParameterAdaptation.cpp - LinearParameterAdaptation.cpp - RuleParser.cpp - EnumValuePair.cpp) + XmlElementSerializingContext.cpp + XmlFileIncluderElement.cpp + XmlParameterSerializingContext.cpp) include_directories( include -- cgit v1.1 From 36f40a0b7eee0a6d8b6ca54fdfb1b9043845a555 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 6 Jan 2015 18:33:36 +0100 Subject: New ParamegerMgr "Full" connector This is a new connector that implements (almost) all of the parameter-framework capabilities, in contrast to CParameterMgrPlatformConnector which only implements criteria creation, modification, and application and dynamic parameter handling capabilities. It will allow user to programatically do whatever the PFW can do, e.g. create domains and configurations. Change-Id: Ide118aaaae4f84fa7280d2cae470de0c024c0f00 Signed-off-by: David Wagner --- parameter/Android.mk | 2 + parameter/CMakeLists.txt | 2 + parameter/ParameterMgrFullConnector.cpp | 350 ++++++++++++++++++++++++++ parameter/include/ParameterMgrFullConnector.h | 259 +++++++++++++++++++ 4 files changed, 613 insertions(+) create mode 100644 parameter/ParameterMgrFullConnector.cpp create mode 100644 parameter/include/ParameterMgrFullConnector.h (limited to 'parameter') diff --git a/parameter/Android.mk b/parameter/Android.mk index 0625c2b..8592c52 100644 --- a/parameter/Android.mk +++ b/parameter/Android.mk @@ -36,6 +36,7 @@ common_copy_headers_to := parameter common_copy_headers := \ include/ParameterMgrLoggerForward.h \ include/ParameterMgrPlatformConnector.h \ + include/ParameterMgrFullConnector.h \ include/SelectionCriterionTypeInterface.h \ include/SelectionCriterionInterface.h \ include/ParameterHandle.h @@ -88,6 +89,7 @@ common_src_files := \ ParameterFrameworkConfiguration.cpp \ ParameterHandle.cpp \ ParameterMgr.cpp \ + ParameterMgrFullConnector.cpp \ ParameterMgrPlatformConnector.cpp \ ParameterType.cpp \ PathNavigator.cpp \ diff --git a/parameter/CMakeLists.txt b/parameter/CMakeLists.txt index cf2449e..7d91a82 100644 --- a/parameter/CMakeLists.txt +++ b/parameter/CMakeLists.txt @@ -74,6 +74,7 @@ add_library(parameter SHARED ParameterFrameworkConfiguration.cpp ParameterHandle.cpp ParameterMgr.cpp + ParameterMgrFullConnector.cpp ParameterMgrPlatformConnector.cpp ParameterType.cpp PathNavigator.cpp @@ -115,6 +116,7 @@ install(TARGETS parameter LIBRARY DESTINATION lib) install(FILES include/ParameterHandle.h include/ParameterMgrLoggerForward.h + include/ParameterMgrFullConnector.h include/ParameterMgrPlatformConnector.h include/SelectionCriterionInterface.h include/SelectionCriterionTypeInterface.h diff --git a/parameter/ParameterMgrFullConnector.cpp b/parameter/ParameterMgrFullConnector.cpp new file mode 100644 index 0000000..92a8e04 --- /dev/null +++ b/parameter/ParameterMgrFullConnector.cpp @@ -0,0 +1,350 @@ +/* + * Copyright (c) 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 "ParameterMgrFullConnector.h" +#include "ParameterMgr.h" +#include "ParameterMgrLogger.h" + +#include + +using std::string; + +CParameterMgrFullConnector::CParameterMgrFullConnector(const string& strConfigurationFilePath) : + _pParameterMgr(new CParameterMgr(strConfigurationFilePath)), _pLogger(NULL) +{ + _pParameterMgrLogger = new CParameterMgrLogger(*this); + _pParameterMgr->setLogger(_pParameterMgrLogger); +} + +CParameterMgrFullConnector::~CParameterMgrFullConnector() +{ + delete _pParameterMgr; + delete _pParameterMgrLogger; +} + + +bool CParameterMgrFullConnector::start(string& strError) +{ + // Create data structure & Init flow + return _pParameterMgr->load(strError) && _pParameterMgr->init(strError); +} + +void CParameterMgrFullConnector::setLogger(CParameterMgrFullConnector::ILogger* pLogger) +{ + _pLogger = pLogger; +} + +// Private logging +void CParameterMgrFullConnector::doLog(bool bIsWarning, const string& strLog) +{ + if (_pLogger) { + + _pLogger->log(bIsWarning, strLog); + } +} + +CParameterHandle* CParameterMgrFullConnector::createParameterHandle(const string& strPath, + string& strError) +{ + return _pParameterMgr->createParameterHandle(strPath, strError); +} + +ISelectionCriterionTypeInterface* CParameterMgrFullConnector::createSelectionCriterionType( + bool bIsInclusive) +{ + return _pParameterMgr->createSelectionCriterionType(bIsInclusive); +} + +ISelectionCriterionInterface* CParameterMgrFullConnector::createSelectionCriterion( + const string& strName, + const ISelectionCriterionTypeInterface* pSelectionCriterionType) +{ + return _pParameterMgr->createSelectionCriterion(strName, + static_cast(pSelectionCriterionType)); +} + +ISelectionCriterionInterface* CParameterMgrFullConnector::getSelectionCriterion( + const string& strName) +{ + return _pParameterMgr->getSelectionCriterion(strName); +} + +void CParameterMgrFullConnector::applyConfigurations() +{ + return _pParameterMgr->applyConfigurations(); +} + +void CParameterMgrFullConnector::setFailureOnMissingSubsystem(bool bFail) +{ + _pParameterMgr->setFailureOnMissingSubsystem(bFail); +} + +bool CParameterMgrFullConnector::getFailureOnMissingSubsystem() const +{ + return _pParameterMgr->getFailureOnMissingSubsystem(); +} + +void CParameterMgrFullConnector::setFailureOnFailedSettingsLoad(bool bFail) +{ + _pParameterMgr->setFailureOnFailedSettingsLoad(bFail); +} + +bool CParameterMgrFullConnector::getFailureOnFailedSettingsLoad() +{ + return _pParameterMgr->getFailureOnFailedSettingsLoad(); +} + +void CParameterMgrFullConnector::setValidateSchemasOnStart(bool bValidate) +{ + _pParameterMgr->setValidateSchemasOnStart(bValidate); +} + +bool CParameterMgrFullConnector::getValidateSchemasOnStart() const +{ + return _pParameterMgr->getValidateSchemasOnStart(); +} + +bool CParameterMgrFullConnector::setTuningMode(bool bOn, string& strError) +{ + return _pParameterMgr->setTuningMode(bOn, strError); +} + +bool CParameterMgrFullConnector::isTuningModeOn() const +{ + return _pParameterMgr->tuningModeOn(); +} + +void CParameterMgrFullConnector::setValueSpace(bool bIsRaw) +{ + return _pParameterMgr->setValueSpace(bIsRaw); +} + +bool CParameterMgrFullConnector::isValueSpaceRaw() const +{ + return _pParameterMgr->valueSpaceIsRaw(); +} + +void CParameterMgrFullConnector::setOutputRawFormat(bool bIsHex) +{ + return _pParameterMgr->setOutputRawFormat(bIsHex); +} + +bool CParameterMgrFullConnector::isOutputRawFormatHex() const +{ + return _pParameterMgr->outputRawFormatIsHex(); +} + +bool CParameterMgrFullConnector::setAutoSync(bool bAutoSyncOn, string& strError) +{ + return _pParameterMgr->setAutoSync(bAutoSyncOn, strError); +} + +bool CParameterMgrFullConnector::isAutoSyncOn() const +{ + return _pParameterMgr->autoSyncOn(); +} + +bool CParameterMgrFullConnector::sync(string& strError) +{ + return _pParameterMgr->sync(strError); +} + +bool CParameterMgrFullConnector::accessParameterValue(const string& strPath, string& strValue, + bool bSet, string& strError) +{ + return _pParameterMgr->accessParameterValue(strPath, strValue, bSet, strError); +} + +bool CParameterMgrFullConnector::accessConfigurationValue(const string &strDomain, + const string &strConfiguration, + const string& strPath, string& strValue, + bool bSet, string& strError) +{ + return _pParameterMgr->accessConfigurationValue(strDomain, strConfiguration, strPath, strValue, + bSet, strError); +} + +bool CParameterMgrFullConnector::getParameterMapping(const string& strPath, string& strValue) const +{ + return _pParameterMgr->getParameterMapping(strPath, strValue); +} + +bool CParameterMgrFullConnector::createDomain(const string& strName, string& strError) +{ + return _pParameterMgr->createDomain(strName, strError); +} + +bool CParameterMgrFullConnector::deleteDomain(const string& strName, string& strError) +{ + return _pParameterMgr->deleteDomain(strName, strError); +} + +bool CParameterMgrFullConnector::renameDomain(const string& strName, const string& strNewName, + string& strError) +{ + return _pParameterMgr->renameDomain(strName, strNewName, strError); +} + +bool CParameterMgrFullConnector::deleteAllDomains(string& strError) +{ + return _pParameterMgr->deleteAllDomains(strError); +} + +bool CParameterMgrFullConnector::createConfiguration(const string& strDomain, + const string& strConfiguration, + string& strError) +{ + return _pParameterMgr->createConfiguration(strDomain, strConfiguration, strError); +} + +bool CParameterMgrFullConnector::deleteConfiguration(const string& strDomain, + const string& strConfiguration, + string& strError) +{ + return _pParameterMgr->deleteConfiguration(strDomain, strConfiguration, strError); +} + +bool CParameterMgrFullConnector::renameConfiguration(const string& strDomain, + const string& strConfiguration, + const string& strNewConfiguration, + string& strError) +{ + return _pParameterMgr->renameConfiguration(strDomain, strConfiguration, strNewConfiguration, + strError); +} + +bool CParameterMgrFullConnector::saveConfiguration(const string& strDomain, + const string& strConfiguration, string& strError) +{ + return _pParameterMgr->saveConfiguration(strDomain, strConfiguration, strError); +} + +bool CParameterMgrFullConnector::restoreConfiguration(const string& strDomain, + const string& strConfiguration, + std::list& lstrError) +{ + return _pParameterMgr->restoreConfiguration(strDomain, strConfiguration, lstrError); +} + +bool CParameterMgrFullConnector::setSequenceAwareness(const string& strName, bool bSequenceAware, + string& strResult) +{ + return _pParameterMgr->setSequenceAwareness(strName, bSequenceAware, strResult); +} + +bool CParameterMgrFullConnector::getSequenceAwareness(const string& strName, bool& bSequenceAware, + string& strResult) +{ + return _pParameterMgr->getSequenceAwareness(strName, bSequenceAware, strResult); +} + +bool CParameterMgrFullConnector::addConfigurableElementToDomain(const string& strDomain, + const string& strConfigurableElementPath, string& strError) +{ + return _pParameterMgr->addConfigurableElementToDomain(strDomain, strConfigurableElementPath, + strError); +} + +bool CParameterMgrFullConnector::removeConfigurableElementFromDomain(const string& strDomain, + const string& strConfigurableElementPath, string& strError) +{ + return _pParameterMgr->removeConfigurableElementFromDomain(strDomain, + strConfigurableElementPath, strError); +} + +bool CParameterMgrFullConnector::split(const string& strDomain, + const string& strConfigurableElementPath, string& strError) +{ + return _pParameterMgr->split(strDomain, strConfigurableElementPath, strError); +} + +bool CParameterMgrFullConnector::setElementSequence(const string& strDomain, + const string& strConfiguration, + const std::vector& astrNewElementSequence, + string& strError) +{ + return _pParameterMgr->setElementSequence(strDomain, strConfiguration, astrNewElementSequence, + strError); +} + +bool CParameterMgrFullConnector::setApplicationRule(const string& strDomain, + const string& strConfiguration, + const string& strApplicationRule, + string& strError) +{ + return _pParameterMgr->setApplicationRule(strDomain, strConfiguration, strApplicationRule, + strError); +} + + +bool CParameterMgrFullConnector::getApplicationRule(const string& strDomain, + const string& strConfiguration, + string& strResult) +{ + return _pParameterMgr->getApplicationRule(strDomain, strConfiguration, strResult); +} +bool CParameterMgrFullConnector::clearApplicationRule(const string& strDomain, + const string& strConfiguration, + string& strError) +{ + return _pParameterMgr->clearApplicationRule(strDomain, strConfiguration, strError); +} + + +bool CParameterMgrFullConnector::importDomainsXml(const string& strXmlSource, bool bWithSettings, + bool bFromFile, string& strError) +{ + return _pParameterMgr->importDomainsXml(strXmlSource, bWithSettings, bFromFile, strError); +} + +bool CParameterMgrFullConnector::exportDomainsXml(string& strXmlDest, bool bWithSettings, + bool bToFile, string& strError) const +{ + return _pParameterMgr->exportDomainsXml(strXmlDest, bWithSettings, bToFile, strError); +} + +bool CParameterMgrFullConnector::importSingleDomainXml(const string& strXmlSource, bool bOverwrite, + string& strError) +{ + return _pParameterMgr->importSingleDomainXml(strXmlSource, bOverwrite, strError); +} + +bool CParameterMgrFullConnector::exportSingleDomainXml(string& strXmlDest, + const string& strDomainName, + bool bWithSettings, bool bToFile, + string& strError) const +{ + return _pParameterMgr->exportSingleDomainXml(strXmlDest, strDomainName, bWithSettings, bToFile, + strError); +} + +bool CParameterMgrFullConnector::getSystemClassXMLString(string& strResult) +{ + return _pParameterMgr->getSystemClassXMLString(strResult); +} diff --git a/parameter/include/ParameterMgrFullConnector.h b/parameter/include/ParameterMgrFullConnector.h new file mode 100644 index 0000000..1288c69 --- /dev/null +++ b/parameter/include/ParameterMgrFullConnector.h @@ -0,0 +1,259 @@ +/* + * Copyright (c) 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 "SelectionCriterionTypeInterface.h" +#include "SelectionCriterionInterface.h" +#include "ParameterHandle.h" +#include "ParameterMgrLoggerForward.h" + +#include +#include +#include +#include + +class CParameterMgr; + +class CParameterMgrFullConnector +{ + friend class CParameterMgrLogger; + +public: + CParameterMgrFullConnector(const std::string& strConfigurationFilePath); + ~CParameterMgrFullConnector(); + + class ILogger + { + public: + virtual void log(bool bIsWarning, const std::string& strLog) = 0; + protected: + virtual ~ILogger() {} + }; + // Logging + /** Should be called before start */ + void setLogger(ILogger* pLogger); + + + bool start(std::string& strError); + + // Dynamic parameter handling + CParameterHandle* createParameterHandle(const std::string& strPath, std::string& strError); + + ISelectionCriterionTypeInterface* createSelectionCriterionType(bool bIsInclusive); + ISelectionCriterionInterface* createSelectionCriterion(const std::string& strName, + const ISelectionCriterionTypeInterface* pSelectionCriterionType); + ISelectionCriterionInterface* getSelectionCriterion(const std::string& strName); + + void applyConfigurations(); + + /** Should start fail in case of missing subsystems. + * + * @param[in] bFail: If set to true, parameterMgr start will fail on missing subsystems. + * If set to false, missing subsystems will fallback on virtual subsystem. + */ + void setFailureOnMissingSubsystem(bool bFail); + + /** Would start fail in case of missing subsystems. + * + * @return true if the subsystem will fail on missing subsystem, false otherwise. + */ + bool getFailureOnMissingSubsystem() const; + + /** Should start fail in failed settings load. + * + * @param[in] bFail: If set to true, parameterMgr start will fail on failed settings load. + * If set to false, failed settings load will be ignored. + */ + void setFailureOnFailedSettingsLoad(bool bFail); + /** Would start fail in case of failed settings load. + * + * @return failure on failed settings load policy state. + */ + bool getFailureOnFailedSettingsLoad(); + + /** Should .xml files be validated on start ? + * + * @param[in] bValidate: + * If set to true, parameterMgr will report an error + * when being unable to validate .xml files + * If set to false, no .xml/xsd validation will happen + * (default behaviour) + * + * @return false if unable to set, true otherwise. + */ + void setValidateSchemasOnStart(bool bValidate); + + /** Would .xml files be validated on start? + * + * @return areSchemasValidated + */ + bool getValidateSchemasOnStart() const; + //////////// Tuning ///////////// + // Tuning mode + bool setTuningMode(bool bOn, std::string& strError); + bool isTuningModeOn() const; + + // Current value space for user set/get value interpretation + void setValueSpace(bool bIsRaw); + bool isValueSpaceRaw() const; + + // Current Output Raw Format for user get value interpretation + void setOutputRawFormat(bool bIsHex); + bool isOutputRawFormatHex() const; + // Automatic hardware synchronization control (during tuning session) + bool setAutoSync(bool bAutoSyncOn, std::string& strError); + bool isAutoSyncOn() const; + bool sync(std::string& strError); + + // User set/get parameters + bool accessParameterValue(const std::string& strPath, std::string& strValue, bool bSet, std::string& strError); + bool accessConfigurationValue(const std::string &strDomain, const std::string &strConfiguration, const std::string& strPath, std::string& strValue, bool bSet, std::string& strError); + + /** + * Returns the element mapping corresponding to the path given in parameter. + * + * @param[in] strPath Path of an element + * @param[out] strValue A sting containing the mapping + * + * @return true if a mapping was found for this element + */ + bool getParameterMapping(const std::string& strPath, std::string& strValue) const; + ////////// Configuration/Domains handling ////////////// + // Creation/Deletion + bool createDomain(const std::string& strName, std::string& strError); + bool deleteDomain(const std::string& strName, std::string& strError); + bool renameDomain(const std::string& strName, const std::string& strNewName, std::string& strError); + bool deleteAllDomains(std::string& strError); + bool setSequenceAwareness(const std::string& strName, bool bSequenceAware, std::string& strResult); + bool getSequenceAwareness(const std::string& strName, bool& bSequenceAware, std::string& strResult); + bool createConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError); + bool deleteConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError); + bool renameConfiguration(const std::string& strDomain, const std::string& strConfiguration, const std::string& strNewConfiguration, std::string& strError); + + // Save/Restore + bool restoreConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::list& strError); + bool saveConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError); + + // Configurable element - domain association + bool addConfigurableElementToDomain(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError); + bool removeConfigurableElementFromDomain(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError); + bool split(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError); + bool setElementSequence(const std::string& strDomain, const std::string& strConfiguration, const std::vector& astrNewElementSequence, std::string& strError); + + bool setApplicationRule(const std::string& strDomain, const std::string& strConfiguration, + const std::string& strApplicationRule, std::string& strError); + bool getApplicationRule(const std::string& strDomain, const std::string& strConfiguration, + std::string& strResult); + bool clearApplicationRule(const std::string& strDomain, const std::string& strConfiguration, std::string& strError); + + /** + * Method that imports Configurable Domains from an Xml source. + * + * @param[in] strXmlSource a string containing an xml description or a path to an xml file + * @param[in] bWithSettings a boolean that determines if the settings should be used in the + * xml description + * @param[in] bFromFile a boolean that determines if the source is an xml description in + * strXmlSource or contained in a file. In that case strXmlSource is just the file path. + * @param[out] strError is used as the error output + * + * @return false if any error occures + */ + bool importDomainsXml(const std::string& strXmlSource, bool bWithSettings, bool bFromFile, + std::string& strError); + /** + * Method that imports a single Configurable Domain from an Xml source. + * + * @param[in] strXmlSource a string containing an xml description or a path to an xml file + * @param[in] bWithSettings a boolean that determines if the settings should be used in the + * xml description + * @param[in] bFromFile a boolean that determines if the source is an xml description in + * strXmlSource or contained in a file. In that case strXmlSource is just the file path. + * @param[out] strError is used as the error output + * + * @return false if any error occurs + */ + bool importSingleDomainXml(const std::string& strXmlSource, bool bOverwrite, + std::string& strError); + + + /** + * Method that exports Configurable Domains to an Xml destination. + * + * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file + * @param[in] bWithSettings a boolean that determines if the settings should be used in the + * xml description + * @param[in] bToFile a boolean that determines if the destination is an xml description in + * strXmlDest or contained in a file. In that case strXmlDest is just the file path. + * @param[out] strError is used as the error output + * + * @return false if any error occures, true otherwise. + */ + bool exportDomainsXml(std::string& strXmlDest, bool bWithSettings, bool bToFile, + std::string& strError) const; + + /** + * Method that exports a given Configurable Domain to an Xml destination. + * + * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file + * @param[in] strDomainName the name of the domain to be exported + * @param[in] bWithSettings a boolean that determines if the settings should be used in the + * xml description + * @param[in] bToFile a boolean that determines if the destination is an xml description in + * strXmlDest or contained in a file. In that case strXmlDest is just the file path. + * @param[out] strError is used as the error output + * + * @return false if any error occurs, true otherwise. + */ + 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&); + CParameterMgrFullConnector& operator=(const CParameterMgrFullConnector&); + + void doLog(bool bIsWarning, const std::string& strLog); + + CParameterMgr* _pParameterMgr; + + ILogger* _pLogger; + // Log wrapper + CParameterMgrLogger* _pParameterMgrLogger; +}; -- cgit v1.1