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>
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 @@
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 @@
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 @@
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()
{