From 592ae56e6f8bc22c57224eb0528dd80caffa70de Mon Sep 17 00:00:00 2001 From: Patrick Benavoli Date: Mon, 5 Sep 2011 16:53:58 +0200 Subject: parameter-framework: Improvements & corrections 2 BZ: 9026 1. auto sync off now causes a global forward resynchronization 2. Added version info 3. Libxml2 cleanup correclty scheduled for process end 4. Changed criterion rule id / name association array to const 5. Nesting counter used for logs now mutable Change-Id: I1f86ee9a56a501ded97706a1d6b877b80950a021 Orig-Change-Id: I5a852736f3c5dd592795a2a70eef42ed9d4695b7 Signed-off-by: Patrick Benavoli Reviewed-on: http://android.intel.com:8080/20206 Reviewed-by: Barthes, FabienX Tested-by: Barthes, FabienX Reviewed-by: buildbot Tested-by: buildbot --- parameter/ParameterMgr.cpp | 39 ++++++++++++++++++++++++++---------- parameter/ParameterMgr.h | 12 +++++++++-- parameter/SelectionCriterionRule.cpp | 2 +- parameter/SelectionCriterionRule.h | 2 +- xmlserializer/XmlSerializer.cpp | 2 +- 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index 87f6662..a8335c8 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -101,9 +101,11 @@ const char* gacSystemSchemasSubFolder = "Schemas"; // Remote command parser array -const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gaRemoteCommandParserItems[] = { +const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandParserItems[] = { /// Help { "help", &CParameterMgr::helpCommandProcess, 0, "", "Show commands description and usage" }, + /// Version + { "version", &CParameterMgr::versionCommandProcess, 0, "", "Show version" }, /// Status { "status", &CParameterMgr::statusCommandProcess, 0, "", "Show current status" }, /// Tuning Mode @@ -139,7 +141,7 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gaRemoteCommandPars { "restoreConfiguration", &CParameterMgr::restoreConfigurationCommmandProcess, 2, " ", "Restore current settings from configuration" }, /// Elements/Parameters { "listElements", &CParameterMgr::listElementsCommmandProcess, 1, "|/", "List elements under element at given path or root" }, - { "listParameters", &CParameterMgr::listParametersCommmandProcess, 1, "|/", "Recursively list elements under element at given path or root" }, + { "listParameters", &CParameterMgr::listParametersCommmandProcess, 1, "|/", "List parameters under element at given path or root" }, { "dumpElement", &CParameterMgr::dumpElementCommmandProcess, 1, "", "Dump structure and content of element at given path" }, { "getElementSize", &CParameterMgr::getElementSizeCommmandProcess, 1, "", "Show size of element at given path" }, { "showProperties", &CParameterMgr::showPropertiesCommmandProcess, 1, "", "Show properties of element at given path" }, @@ -160,7 +162,7 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gaRemoteCommandPars { "importSettings", &CParameterMgr::importSettingsCommmandProcess, 1, "", "Import settings from binary file" } }; // Remote command parsers array Size -const uint32_t CParameterMgr::guiNbRemoteCommandParserItems = sizeof(gaRemoteCommandParserItems) / sizeof(gaRemoteCommandParserItems[0]); +const uint32_t CParameterMgr::guiNbRemoteCommandParserItems = sizeof(gastRemoteCommandParserItems) / sizeof(gastRemoteCommandParserItems[0]); CParameterMgr::CParameterMgr(const string& strParameterFrameworkConfigurationFolderPath, const string& strSystemClassName) : _bTuningModeIsOn(false), @@ -237,12 +239,12 @@ void CParameterMgr::doLog(const string& strLog) const void CParameterMgr::nestLog() const { - ((uint32_t&)_uiLogDepth)++; + _uiLogDepth++; } void CParameterMgr::unnestLog() const { - ((uint32_t&)_uiLogDepth)--; + _uiLogDepth--; } bool CParameterMgr::load(string& strError) @@ -582,7 +584,7 @@ bool CParameterMgr::remoteCommandProcess(const IRemoteCommand& remoteCommand, st for (uiRemoteCommandParserItem = 0; uiRemoteCommandParserItem < guiNbRemoteCommandParserItems; uiRemoteCommandParserItem++) { - const SRemoteCommandParserItem* pRemoteCommandParserItem = &gaRemoteCommandParserItems[uiRemoteCommandParserItem]; + const SRemoteCommandParserItem* pRemoteCommandParserItem = &gastRemoteCommandParserItems[uiRemoteCommandParserItem]; if (string(pRemoteCommandParserItem->_pcCommandName) == remoteCommand.getCommand()) { @@ -623,7 +625,7 @@ void CParameterMgr::setMaxCommandUsageLength() for (uiRemoteCommandParserItem = 0; uiRemoteCommandParserItem < guiNbRemoteCommandParserItems; uiRemoteCommandParserItem++) { - const SRemoteCommandParserItem* pRemoteCommandParserItem = &gaRemoteCommandParserItems[uiRemoteCommandParserItem]; + const SRemoteCommandParserItem* pRemoteCommandParserItem = &gastRemoteCommandParserItems[uiRemoteCommandParserItem]; uint32_t uiRemoteCommandUsageLength = pRemoteCommandParserItem->usage().length(); @@ -647,7 +649,7 @@ CParameterMgr::CommandStatus CParameterMgr::helpCommandProcess(const IRemoteComm for (uiRemoteCommandParserItem = 0; uiRemoteCommandParserItem < guiNbRemoteCommandParserItems; uiRemoteCommandParserItem++) { - const SRemoteCommandParserItem* pRemoteCommandParserItem = &gaRemoteCommandParserItems[uiRemoteCommandParserItem]; + const SRemoteCommandParserItem* pRemoteCommandParserItem = &gastRemoteCommandParserItems[uiRemoteCommandParserItem]; string strUsage = pRemoteCommandParserItem->usage(); @@ -667,6 +669,22 @@ CParameterMgr::CommandStatus CParameterMgr::helpCommandProcess(const IRemoteComm return ESucceeded; } +/// Version +CParameterMgr::CommandStatus CParameterMgr::versionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) +{ + (void)remoteCommand; + + // Show versions + // Major + strResult = toString(guiEditionMajor) + "."; + // Minor + strResult += toString(guiEditionMinor) + "."; + // Revision + strResult += toString(guiRevision); + + return ESucceeded; +} + /// Status CParameterMgr::CommandStatus CParameterMgr::statusCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) { @@ -1327,9 +1345,8 @@ bool CParameterMgr::setAutoSync(bool bAutoSyncOn, string& strError) // Warn domains about turning auto sync back on if (bAutoSyncOn && !_bAutoSyncOn) { - // Ensure application of currently selected configurations - // Force-apply configurations - if (!getConfigurableDomains()->apply(_pMainParameterBlackboard, true, strError)) { + // Do the synchronization at system class level (could be optimized by keeping track of all modified parameters) + if (!sync(strError)) { return false; } diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h index 003a643..74440f8 100644 --- a/parameter/ParameterMgr.h +++ b/parameter/ParameterMgr.h @@ -40,6 +40,7 @@ #include #include + class CElementLibrarySet; class CSubsystemLibrary; class CSystemClass; @@ -90,6 +91,11 @@ class CParameterMgr : private CElement, private IRemoteCommandHandler, private I return string(_pcCommandName) + " " + _pcHelp; } }; + + // Version + static const uint32_t guiEditionMajor = 0x0; + static const uint32_t guiEditionMinor = 0x1; + static const uint32_t guiRevision = 0x1; public: // Logger interface class ILogger @@ -179,6 +185,8 @@ private: ////////////////:: Remote command parsers /// Help CommandStatus helpCommandProcess(const IRemoteCommand& remoteCommand, string& strResult); + /// Version + CommandStatus versionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult); /// Status CommandStatus statusCommandProcess(const IRemoteCommand& remoteCommand, string& strResult); /// Tuning Mode @@ -313,7 +321,7 @@ private: IRemoteProcessorServerInterface* _pRemoteProcessorServer; // Parser description array - static const SRemoteCommandParserItem gaRemoteCommandParserItems[]; + static const SRemoteCommandParserItem gastRemoteCommandParserItems[]; // Parser description array size static const uint32_t guiNbRemoteCommandParserItems; @@ -326,6 +334,6 @@ private: // Logging ILogger* _pLogger; - uint32_t _uiLogDepth; + mutable uint32_t _uiLogDepth; }; diff --git a/parameter/SelectionCriterionRule.cpp b/parameter/SelectionCriterionRule.cpp index e43c9e8..eec88be 100644 --- a/parameter/SelectionCriterionRule.cpp +++ b/parameter/SelectionCriterionRule.cpp @@ -37,7 +37,7 @@ #define base CRule -CSelectionCriterionRule::SMatchingRuleDescription CSelectionCriterionRule::_astMatchesWhen[CSelectionCriterionRule::ENbMatchesWhen] = { +const CSelectionCriterionRule::SMatchingRuleDescription CSelectionCriterionRule::_astMatchesWhen[CSelectionCriterionRule::ENbMatchesWhen] = { { "Is", false }, { "IsNot", false }, { "Includes", true }, diff --git a/parameter/SelectionCriterionRule.h b/parameter/SelectionCriterionRule.h index 528e584..51f22e7 100644 --- a/parameter/SelectionCriterionRule.h +++ b/parameter/SelectionCriterionRule.h @@ -80,6 +80,6 @@ private: int32_t _iMatchValue; // Used for XML MatchesWhen attribute parsing - static SMatchingRuleDescription _astMatchesWhen[ENbMatchesWhen]; + static const SMatchingRuleDescription _astMatchesWhen[ENbMatchesWhen]; }; diff --git a/xmlserializer/XmlSerializer.cpp b/xmlserializer/XmlSerializer.cpp index 73ae90c..0c4f5ff 100644 --- a/xmlserializer/XmlSerializer.cpp +++ b/xmlserializer/XmlSerializer.cpp @@ -38,7 +38,7 @@ bool CXmlSerializer::_bLibXml2CleanupScheduled; CXmlSerializer::CXmlSerializer(const string& strXmlInstanceFile, const string& strXmlSchemaFile, const string& strRootElementType, CXmlSerializingContext& serializingContext) : _strXmlInstanceFile(strXmlInstanceFile), _strXmlSchemaFile(strXmlSchemaFile), _strRootElementType(strRootElementType), _serializingContext(serializingContext), _pDoc(NULL), _pRootNode(NULL) { - if (_bLibXml2CleanupScheduled) { + if (!_bLibXml2CleanupScheduled) { // Schedule cleanup atexit(xmlCleanupParser); -- cgit v1.1