From daaa63ce33fa4795403f9339bc872694c9ab6113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Boisnard?= Date: Mon, 27 Aug 2012 15:48:15 +0200 Subject: PFW: Display warning messages to help user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BZ: 54512 Display a warning message when a configuration cannot be applied because the TuningMode is on, in order to help user to identify potential issues. Display a warning message when a criterion change doesn't lead to a configuration application (a check is performed each time a criterion is changed). Change-Id: Id872655c92770d1f6f1b01b20db2fde3db826ceb Signed-off-by: Frédéric Boisnard Reviewed-on: http://android.intel.com:8080/63845 Reviewed-by: Rocard, KevinX Reviewed-by: De Chivre, Renaud Reviewed-by: Denneulin, Guillaume Tested-by: Barthes, FabienX Reviewed-by: buildbot Tested-by: buildbot --- parameter/ParameterMgr.cpp | 9 ++++++++- parameter/SelectionCriteria.cpp | 6 ++++++ parameter/SelectionCriteria.h | 5 ++++- parameter/SelectionCriteriaDefinition.cpp | 15 +++++++++++++++ parameter/SelectionCriteriaDefinition.h | 3 +++ parameter/SelectionCriterion.cpp | 22 +++++++++++++++++++++- parameter/SelectionCriterion.h | 5 +++++ 7 files changed, 62 insertions(+), 3 deletions(-) diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index 9f1d160..14a5b4b 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -1,4 +1,4 @@ -/* +/* * INTEL CONFIDENTIAL * Copyright © 2011 Intel * Corporation All Rights Reserved. @@ -576,6 +576,13 @@ bool CParameterMgr::applyConfigurations(string& strError) return false; } + + // Reset the modified status of the current criteria to indicate that a new configuration has been applied + getSelectionCriteria()->resetModifiedStatus(); + + } else { + + log("Warning: Configurations were not applied because the TuningMode is on"); } return true; diff --git a/parameter/SelectionCriteria.cpp b/parameter/SelectionCriteria.cpp index 9a4aa04..f75ec35 100644 --- a/parameter/SelectionCriteria.cpp +++ b/parameter/SelectionCriteria.cpp @@ -62,6 +62,12 @@ void CSelectionCriteria::listSelectionCriteria(string& strResult, bool bWithType getSelectionCriteriaDefinition()->listSelectionCriteria(strResult, bWithTypeInfo); } +// Reset the modified status of the children +void CSelectionCriteria::resetModifiedStatus() +{ + getSelectionCriteriaDefinition()->resetModifiedStatus(); +} + // Children access CSelectionCriterionLibrary* CSelectionCriteria::getSelectionCriterionLibrary() { diff --git a/parameter/SelectionCriteria.h b/parameter/SelectionCriteria.h index 19cfcdc..dd274d0 100644 --- a/parameter/SelectionCriteria.h +++ b/parameter/SelectionCriteria.h @@ -1,4 +1,4 @@ -/* +/* * INTEL CONFIDENTIAL * Copyright © 2011 Intel * Corporation All Rights Reserved. @@ -55,6 +55,9 @@ public: // Base virtual string getKind() const; + + // Reset the modified status of the children + void resetModifiedStatus(); private: // Children access CSelectionCriterionLibrary* getSelectionCriterionLibrary(); diff --git a/parameter/SelectionCriteriaDefinition.cpp b/parameter/SelectionCriteriaDefinition.cpp index ab2c42f..7027a94 100644 --- a/parameter/SelectionCriteriaDefinition.cpp +++ b/parameter/SelectionCriteriaDefinition.cpp @@ -70,3 +70,18 @@ void CSelectionCriteriaDefinition::listSelectionCriteria(string& strResult, bool } } +// Reset the modified status of the children +void CSelectionCriteriaDefinition::resetModifiedStatus() +{ + // Propagate + uint32_t uiNbChildren = getNbChildren(); + uint32_t uiChild; + CSelectionCriterion* pSelectionCriterion; + + for (uiChild = 0; uiChild < uiNbChildren; uiChild++) { + + pSelectionCriterion = static_cast(getChild(uiChild)); + + pSelectionCriterion->resetModifiedStatus(); + } +} diff --git a/parameter/SelectionCriteriaDefinition.h b/parameter/SelectionCriteriaDefinition.h index 6d6a24d..337f7c3 100644 --- a/parameter/SelectionCriteriaDefinition.h +++ b/parameter/SelectionCriteriaDefinition.h @@ -46,5 +46,8 @@ public: // Base virtual string getKind() const; + + // Reset the modified status of the children + void resetModifiedStatus(); }; diff --git a/parameter/SelectionCriterion.cpp b/parameter/SelectionCriterion.cpp index 7f2809a..453f244 100644 --- a/parameter/SelectionCriterion.cpp +++ b/parameter/SelectionCriterion.cpp @@ -27,7 +27,7 @@ #define base CElement -CSelectionCriterion::CSelectionCriterion(const string& strName, const CSelectionCriterionType* pType) : base(strName), _iState(0), _pType(pType) +CSelectionCriterion::CSelectionCriterion(const string& strName, const CSelectionCriterionType* pType) : base(strName), _iState(0), _pType(pType), _uiNbModifications(0) { } @@ -36,6 +36,16 @@ string CSelectionCriterion::getKind() const return "SelectionCriterion"; } +bool CSelectionCriterion::hasBeenModified() const +{ + return _uiNbModifications != 0; +} + +void CSelectionCriterion::resetModifiedStatus() +{ + _uiNbModifications = 0; +} + /// From ISelectionCriterionInterface // State void CSelectionCriterion::setCriterionState(int iState) @@ -46,6 +56,16 @@ void CSelectionCriterion::setCriterionState(int iState) _iState = iState; log("Selection criterion changed event: %s", getFormattedDescription(false).c_str()); + + // Check if the previous criterion value has been taken into account (i.e. at least one Configuration was applied + // since the last criterion change) + if (_uiNbModifications > 0) { + + log("Warning: Selection criterion \"%s\" has been modified %d time(s) without any configuration application", getName().c_str(), _uiNbModifications); + } + + // Track the number of modifications for this criterion + _uiNbModifications++; } } diff --git a/parameter/SelectionCriterion.h b/parameter/SelectionCriterion.h index be6eac2..cf66c45 100644 --- a/parameter/SelectionCriterion.h +++ b/parameter/SelectionCriterion.h @@ -45,6 +45,9 @@ public: virtual string getCriterionName() const; // Type virtual const ISelectionCriterionTypeInterface* getCriterionType() const; + // Modified status + bool hasBeenModified() const; + void resetModifiedStatus(); /// Match methods bool is(int iState) const; @@ -62,5 +65,7 @@ private: int _iState; // Type const CSelectionCriterionType* _pType; + // Counter to know how many modifications have been applied to this criterion + uint8_t _uiNbModifications; }; -- cgit v1.1