From 8b243f50a38a26e6b373287e07cb7e4743a8cd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Boisnard?= Date: Thu, 6 Sep 2012 18:03:20 +0200 Subject: PFW: Show pending configurations in status command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BZ: 56118 Update the "status" command of the PFW to display the current pending configurations for all domains, that is to say configurations that are waiting the next call to "applyConfiguration()" to be applied. This improvement will help developers to better understand the current state of the PFW, in particular when dealing with HAL modifications. Change-Id: I6300620ad8cedcb534fb2859b57b7ab2988fa618 Signed-off-by: Frédéric Boisnard Reviewed-on: http://android.intel.com:8080/64796 Reviewed-by: De Chivre, Renaud Reviewed-by: Benavoli, Patrick Reviewed-by: Rocard, KevinX Tested-by: Barthes, FabienX Reviewed-by: buildbot Tested-by: buildbot --- parameter/ConfigurableDomain.cpp | 29 +++++++++++++++++++++++++++++ parameter/ConfigurableDomain.h | 15 ++++++++++++--- parameter/ConfigurableDomains.cpp | 2 +- parameter/ParameterMgr.cpp | 4 ++-- 4 files changed, 44 insertions(+), 6 deletions(-) (limited to 'parameter') diff --git a/parameter/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp index 01e4a69..8c83f48 100644 --- a/parameter/ConfigurableDomain.cpp +++ b/parameter/ConfigurableDomain.cpp @@ -420,6 +420,23 @@ bool CConfigurableDomain::split(CConfigurableElement* pConfigurableElement, stri return true; } +// Check if there is a pending configuration for this domain: i.e. an applicable configuration different from the last applied configuration +const CDomainConfiguration* CConfigurableDomain::getPendingConfiguration() const +{ + const CDomainConfiguration* pApplicableDomainConfiguration = findApplicableDomainConfiguration(); + + if (pApplicableDomainConfiguration) { + + // Check not the last one before applying + if (!_pLastAppliedConfiguration || (_pLastAppliedConfiguration != pApplicableDomainConfiguration)) { + + return pApplicableDomainConfiguration; + } + } + + return NULL; +} + // Configuration application if required bool CConfigurableDomain::apply(CParameterBlackboard* pParameterBlackboard, CSyncerSet& syncerSet, bool bForce, string& strError) const { @@ -707,6 +724,18 @@ string CConfigurableDomain::getLastAppliedConfigurationName() const return ""; } +// Pending configuration +string CConfigurableDomain::getPendingConfigurationName() const +{ + const CDomainConfiguration* pPendingConfiguration = getPendingConfiguration(); + + if (pPendingConfiguration) { + + return pPendingConfiguration->getName(); + } + return ""; +} + // Ensure validity on whole domain from main blackboard void CConfigurableDomain::validate(const CParameterBlackboard* pMainBlackboard) { diff --git a/parameter/ConfigurableDomain.h b/parameter/ConfigurableDomain.h index ff194c2..29e92cb 100644 --- a/parameter/ConfigurableDomain.h +++ b/parameter/ConfigurableDomain.h @@ -59,9 +59,12 @@ public: bool clearApplicationRule(const string& strConfiguration, string& strError); bool getApplicationRule(const string& strConfiguration, string& strResult) const; - // Last applied configuration + // Last applied configuration name string getLastAppliedConfigurationName() const; + // Pending configuration name + string getPendingConfigurationName() const; + // Associated Configurable elements void gatherConfigurableElements(set& configurableElementSet) const; void listAssociatedToElements(string& strResult) const; @@ -90,10 +93,18 @@ public: // Class kind virtual string getKind() const; + protected: // Content dumping virtual void logValue(string& strValue, CErrorContext& errorContext) const; + private: + // Get pending configuration + const CDomainConfiguration* getPendingConfiguration() const; + + // Search for an applicable configuration + const CDomainConfiguration* findApplicableDomainConfiguration() const; + // Returns true if children dynamic creation is to be dealt with (here, will allow child deletion upon clean) virtual bool childrenAreDynamic() const; @@ -112,8 +123,6 @@ private: // Search for a valid configuration for given configurable element const CDomainConfiguration* findValidDomainConfiguration(const CConfigurableElement* pConfigurableElement) const; - // Search for an applicable configuration - const CDomainConfiguration* findApplicableDomainConfiguration() const; // In case configurable element was removed void computeSyncSet(); diff --git a/parameter/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp index 79bfdac..56693ef 100644 --- a/parameter/ConfigurableDomains.cpp +++ b/parameter/ConfigurableDomains.cpp @@ -481,7 +481,7 @@ void CConfigurableDomains::listLastAppliedConfigurations(string& strResult) cons const CConfigurableDomain* pChildConfigurableDomain = static_cast(getChild(uiChild)); - strResult += pChildConfigurableDomain->getName() + ": " + pChildConfigurableDomain->getLastAppliedConfigurationName() + "\n"; + strResult += pChildConfigurableDomain->getName() + ": " + pChildConfigurableDomain->getLastAppliedConfigurationName() + " [" + pChildConfigurableDomain->getPendingConfigurationName() + "]\n"; } } diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index 14a5b4b..cff2b47 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -678,13 +678,13 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::statusCommandProces strResult += strSubsystemList; /// Last applied configurations - appendTitle(strResult, "Last applied configurations:"); + appendTitle(strResult, "Last Applied [Pending] Configurations:"); string strLastAppliedConfigurations; getConfigurableDomains()->listLastAppliedConfigurations(strLastAppliedConfigurations); strResult += strLastAppliedConfigurations; /// Criteria states - appendTitle(strResult, "Selection criteria:"); + appendTitle(strResult, "Selection Criteria:"); string strSelectionCriteria; getSelectionCriteria()->listSelectionCriteria(strSelectionCriteria, false); strResult += strSelectionCriteria; -- cgit v1.1