aboutsummaryrefslogtreecommitdiffstats
path: root/parameter/ParameterMgr.cpp
diff options
context:
space:
mode:
authorPatrick Benavoli <patrickx.benavoli@intel.com>2011-10-27 14:18:00 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-10 17:14:57 +0100
commit4bed9212041d94d52e55e624bd081fcbf01ee04e (patch)
tree038feec5bb0749ff31674eb7198dbdafe8cb1cf9 /parameter/ParameterMgr.cpp
parent63499d4763e42d76bfd39b79871f611381d2d164 (diff)
downloadexternal_parameter-framework-4bed9212041d94d52e55e624bd081fcbf01ee04e.zip
external_parameter-framework-4bed9212041d94d52e55e624bd081fcbf01ee04e.tar.gz
external_parameter-framework-4bed9212041d94d52e55e624bd081fcbf01ee04e.tar.bz2
PFW: Dynamic parameter access
BZ: 13272 Added dynamic parameter setting / getting interface for hosting platforms This new API allows: - getting any parameter - setting any parameter as long as it is rogue (attached to no domains) Passed parameter values are in the form of strings. Change-Id: I01a34597fcb4dafb225519cbc01dfffb22b5d52a Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/22629 Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com> Reviewed-on: http://android.intel.com:8080/26781 Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com>
Diffstat (limited to 'parameter/ParameterMgr.cpp')
-rw-r--r--parameter/ParameterMgr.cpp158
1 files changed, 95 insertions, 63 deletions
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 0fcd4e2..768a5c5 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -617,6 +617,19 @@ bool CParameterMgr::applyConfigurations(string& strError)
return true;
}
+// Dynamic parameter handling
+bool CParameterMgr::setValue(const string& strPath, const string& strValue, bool bRawValueSpace, string& strError)
+{
+ // Delegate to low level functionality
+ return doSetValue(strPath, strValue, bRawValueSpace, true, strError);
+}
+
+bool CParameterMgr::getValue(const string& strPath, string& strValue, bool bRawValueSpace, bool bHexOutputRawFormat, string& strError) const
+{
+ // Delegate to low level functionality
+ return doGetValue(strPath, strValue, bRawValueSpace, bHexOutputRawFormat, true, strError);
+}
+
/////////////////// Remote command parsers
/// Version
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::versionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
@@ -1219,73 +1232,14 @@ bool CParameterMgr::setValue(const string& strPath, const string& strValue, stri
return false;
}
- CPathNavigator pathNavigator(strPath);
-
- if (!pathNavigator.isPathValid()) {
-
- strError = "Path not well formed";
-
- return false;
- }
-
- string* pStrChildName = pathNavigator.next();
-
- if (!pStrChildName) {
-
- strError = "Non settable element";
-
- return false;
- }
-
- if (*pStrChildName != getSystemClass()->getName()) {
-
- strError = "Path not found";
-
- return false;
- }
-
- // Define context
- CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex);
-
- // Set auto sync
- parameterAccessContext.setAutoSync(_bAutoSyncOn);
-
- // Do the set
- return getSystemClass()->setValue(pathNavigator, strValue, parameterAccessContext);
+ // Delegate to low level functionality
+ return doSetValue(strPath, strValue, _bValueSpaceIsRaw, false, strError);
}
bool CParameterMgr::getValue(const string& strPath, string& strValue, string& strError) const
{
- CPathNavigator pathNavigator(strPath);
-
- if (!pathNavigator.isPathValid()) {
-
- strError = "Path not well formed";
-
- return false;
- }
-
- string* pStrChildName = pathNavigator.next();
-
- if (!pStrChildName) {
-
- strError = "Non settable element";
-
- return false;
- }
-
- if (*pStrChildName != getConstSystemClass()->getName()) {
-
- strError = "Path not found";
-
- return false;
- }
-
- // Define context
- CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex);
-
- // Do the get
- return getConstSystemClass()->getValue(pathNavigator, strValue, parameterAccessContext);
+ // Delegate to low level functionality
+ return doGetValue(strPath, strValue, _bValueSpaceIsRaw, _bOutputRawFormatIsHex, false, strError);
}
// Tuning mode
@@ -1692,6 +1646,84 @@ bool CParameterMgr::checkTuningModeOn(string& strError) const
return true;
}
+// Parameter access
+bool CParameterMgr::doSetValue(const string& strPath, const string& strValue, bool bRawValueSpace, bool bDynamicAccess, string& strError)
+{
+ CPathNavigator pathNavigator(strPath);
+
+ if (!pathNavigator.isPathValid()) {
+
+ strError = "Path not well formed";
+
+ return false;
+ }
+
+ string* pStrChildName = pathNavigator.next();
+
+ if (!pStrChildName) {
+
+ strError = "Non settable element";
+
+ return false;
+ }
+
+ if (*pStrChildName != getSystemClass()->getName()) {
+
+ strError = "Path not found";
+
+ return false;
+ }
+
+ // Define context
+ CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, bRawValueSpace, false);
+
+ // Set auto sync
+ parameterAccessContext.setAutoSync(_bAutoSyncOn);
+
+ // Set dynamic access
+ parameterAccessContext.setDynamicAccess(bDynamicAccess);
+
+ // Do the set
+ return getSystemClass()->setValue(pathNavigator, strValue, parameterAccessContext);
+}
+
+bool CParameterMgr::doGetValue(const string& strPath, string& strValue, bool bRawValueSpace, bool bHexOutputRawFormat, bool bDynamicAccess, string& strError) const
+{
+ CPathNavigator pathNavigator(strPath);
+
+ if (!pathNavigator.isPathValid()) {
+
+ strError = "Path not well formed";
+
+ return false;
+ }
+
+ string* pStrChildName = pathNavigator.next();
+
+ if (!pStrChildName) {
+
+ strError = "Non settable element";
+
+ return false;
+ }
+
+ if (*pStrChildName != getConstSystemClass()->getName()) {
+
+ strError = "Path not found";
+
+ return false;
+ }
+
+ // Define context
+ CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, bRawValueSpace, bHexOutputRawFormat);
+
+ // Set dynamic access
+ parameterAccessContext.setDynamicAccess(bDynamicAccess);
+
+ // Do the get
+ return getConstSystemClass()->getValue(pathNavigator, strValue, parameterAccessContext);
+}
+
// Dynamic creation library feeding
void CParameterMgr::feedElementLibraries()
{