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