summaryrefslogtreecommitdiffstats
path: root/parameter/ParameterMgr.cpp
diff options
context:
space:
mode:
authorFrederic Boisnard <fredericx.boisnard@intel.com>2013-05-23 18:48:58 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:04:04 +0100
commit6cae0ecf49ec7815aa59a4f4a0ec99976ca38032 (patch)
tree36cc121db7d4ff68c665fb153f5b0dc7da62d679 /parameter/ParameterMgr.cpp
parent390b36d8129d3ece769c8542d9d3d3895ab13fbb (diff)
downloadexternal_parameter-framework-6cae0ecf49ec7815aa59a4f4a0ec99976ca38032.zip
external_parameter-framework-6cae0ecf49ec7815aa59a4f4a0ec99976ca38032.tar.gz
external_parameter-framework-6cae0ecf49ec7815aa59a4f4a0ec99976ca38032.tar.bz2
Add showMapping command to the PFW
BZ: 99822 Developers often need to get the mapping corresponding to a specific parameter. However, the PFW doesn't provide a command to achieve this goal. This patch aims to add the showMapping command to the PFW. Change-Id: I05af64a408abe4ceb7f5d177a0ff5fa0461034d0 Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com> Reviewed-on: http://android.intel.com:8080/105145 Reviewed-by: Benavoli, Patrick <patrick.benavoli@intel.com> Reviewed-by: Denneulin, Guillaume <guillaume.denneulin@intel.com> Reviewed-by: Gonzalve, Sebastien <sebastien.gonzalve@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/ParameterMgr.cpp')
-rw-r--r--parameter/ParameterMgr.cpp77
1 files changed, 73 insertions, 4 deletions
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 6293129..fdca8da 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -1,4 +1,4 @@
- /*
+ /*
* INTEL CONFIDENTIAL
* Copyright © 2011 Intel
* Corporation All Rights Reserved.
@@ -71,6 +71,7 @@
#include "ParameterHandle.h"
#include "LinearParameterAdaptation.h"
#include "EnumValuePair.h"
+#include "Subsystem.h"
#include "XmlFileDocSink.h"
#include "XmlFileDocSource.h"
#include "XmlStringDocSink.h"
@@ -221,6 +222,8 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandPa
{ "setConfigurationParameter", &CParameterMgr::setConfigurationParameterCommmandProcess, 4,
"<domain> <configuration> <param path> <value>",
"Set value for parameter at given path to configuration" },
+ { "showMapping", &CParameterMgr::showMappingCommmandProcess, 1,
+ "<elem path>", "Show mapping for an element at given path" },
/// Browse
{ "listAssociatedElements", &CParameterMgr::listAssociatedElementsCommmandProcess, 0,
@@ -671,8 +674,9 @@ void CParameterMgr::applyConfigurations()
}
}
-// Dynamic parameter handling
-CParameterHandle* CParameterMgr::createParameterHandle(const string& strPath, string& strError)
+// Get the configurableElement corresponding to the given path
+const CConfigurableElement* CParameterMgr::getConfigurableElement(const string& strPath,
+ string& strError) const
{
CPathNavigator pathNavigator(strPath);
@@ -695,6 +699,21 @@ CParameterHandle* CParameterMgr::createParameterHandle(const string& strPath, st
// Check found element is a parameter
const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pElement);
+ return pConfigurableElement;
+}
+
+// Dynamic parameter handling
+CParameterHandle* CParameterMgr::createParameterHandle(const string& strPath, string& strError)
+{
+ const CConfigurableElement* pConfigurableElement = getConfigurableElement(strPath, strError);
+
+ if (!pConfigurableElement) {
+
+ // Element not found
+ strError = "Element not found";
+ return NULL;
+ }
+
if (!pConfigurableElement->isParameter()) {
// Element is not parameter
@@ -704,7 +723,7 @@ CParameterHandle* CParameterMgr::createParameterHandle(const string& strPath, st
}
// Convert as parameter and return new handle
- return new CParameterHandle(static_cast<const CBaseParameter*>(pElement), this);
+ return new CParameterHandle(static_cast<const CBaseParameter*>(pConfigurableElement), this);
}
/////////////////// Remote command parsers
@@ -1372,6 +1391,18 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setConfigurationPar
return bSuccess ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showMappingCommmandProcess(
+ const IRemoteCommand& remoteCommand,
+ string& strResult)
+{
+ if (!getParameterMapping(remoteCommand.getArgument(0), strResult)) {
+
+ return CCommandHandler::EFailed;
+ }
+
+ return CCommandHandler::ESucceeded;
+}
+
/// Settings Import/Export
CParameterMgr::CCommandHandler::CommandStatus
CParameterMgr::exportConfigurableDomainsToXMLCommmandProcess(
@@ -1465,6 +1496,42 @@ bool CParameterMgr::accessParameterValue(const string& strPath, string& strValue
return accessValue(parameterAccessContext, strPath, strValue, bSet, strError);
}
+// User get parameter mapping
+bool CParameterMgr::getParameterMapping(const string& strPath, string& strResult) const
+{
+ CPathNavigator pathNavigator(strPath);
+
+ // Nagivate through system class
+ if (!pathNavigator.navigateThrough(getConstSystemClass()->getName(), strResult)) {
+
+ return false;
+ }
+
+ // Get the ConfigurableElement corresponding to strPath
+ const CConfigurableElement* pConfigurableElement = getConfigurableElement(strPath, strResult);
+ if (!pConfigurableElement) {
+
+ return false;
+ }
+
+ // Find the list of the ancestors of the current ConfigurableElement that have a mapping
+ list<const CConfigurableElement*> configurableElementPath;
+ pConfigurableElement->getListOfElementsWithMapping(configurableElementPath);
+
+ // Get the Subsystem containing the ConfigurableElement
+ const CSubsystem* pSubsystem = pConfigurableElement->getBelongingSubsystem();
+ if (!pSubsystem) {
+
+ strResult = "Unable to find the Subsystem containing the parameter";
+ return false;
+ }
+
+ // Fetch the mapping corresponding to the ConfigurableElement
+ strResult = pSubsystem->getMapping(configurableElementPath);
+
+ return true;
+}
+
// User set/get parameters in specific Configuration BlackBoard
bool CParameterMgr::accessConfigurationValue(const string& strDomain, const string& strConfiguration, const string& strPath, string& strValue, bool bSet, string& strError)
{
@@ -1535,6 +1602,8 @@ bool CParameterMgr::accessValue(CParameterAccessContext& parameterAccessContext,
// Nagivate through system class
if (!pathNavigator.navigateThrough(getConstSystemClass()->getName(), strError)) {
+ parameterAccessContext.setError(strError);
+
return false;
}