diff options
author | Patrick Benavoli <patrickx.benavoli@intel.com> | 2011-11-20 15:46:41 +0100 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-10 17:15:00 +0100 |
commit | 065264a93ce9c63b6a5c95e985188ee33ba587d3 (patch) | |
tree | 01897cd4ed658e6a41f21061146098d0385734fd /parameter/ParameterMgr.h | |
parent | 6ccab9d382c08323fb1f000d859a696f05719c92 (diff) | |
download | external_parameter-framework-065264a93ce9c63b6a5c95e985188ee33ba587d3.zip external_parameter-framework-065264a93ce9c63b6a5c95e985188ee33ba587d3.tar.gz external_parameter-framework-065264a93ce9c63b6a5c95e985188ee33ba587d3.tar.bz2 |
PFW: Type safe dynamic parameter access
BZ: 15065
Replaced high level string based parameter access interface with typed ones.
Now hosting platforms that want to control parameters must instantiate a
CParameterHandle object out of the desired parameter path.
CParameterHandle object may be used to access any kind of parameters, whatever
its internal type, whether it's an array or not.
Note that non rogue parameters offer a read access only. Any attempt to write
them will fail.
CParameterHandle objects offer the following kind of parameter accessing
interfaces:
- Boolean
- Integer (signed or unsigned)
- Double
- String
Note that those interfaces are available for scalar as well as for array
parameters.
Not all parameter types support all access kinds. Naturally, array parameters
are only accessed via array interfaces while scalar parameters are managed
through scalar interfaces.
Here's a list of parameter types that may be controlled through each kind of
access interface:
- Boolean access: boolean, bit (bit size must be one);
- Integer access: integer (sign must match), boolean (unsigned access only,
value <= 1), enumerations;
- Double access: for now only fixed points (soon integers will support them
also through platform adaptation objects)
- String access: all parameter types
In addition, cleaned up parameter access related code so as to make it more
generic and reusable.
Changed version to 2.0.0
Change-Id: Ib80868cdb773e90962e48f1f38d2ff0029189815
Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com>
Reviewed-on: http://android.intel.com:8080/25406
Reviewed-by: Barthes, FabienX <fabienx.barthes@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.h')
-rw-r--r-- | parameter/ParameterMgr.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h index c7bdcb6..08c777b 100644 --- a/parameter/ParameterMgr.h +++ b/parameter/ParameterMgr.h @@ -50,6 +50,7 @@ class CParameterBlackboard; class CConfigurableDomains; class IRemoteProcessorServerInterface; class CBackSynchronizer; +class CParameterHandle; class CParameterMgr : private CElement { @@ -64,9 +65,10 @@ class CParameterMgr : private CElement EParameterCreationLibrary, EParameterConfigurationLibrary }; - typedef TRemoteCommandHandlerTemplate<CParameterMgr> CCommandHandler; // Remote command parsers + typedef TRemoteCommandHandlerTemplate<CParameterMgr> CCommandHandler; + typedef CCommandHandler::CommandStatus (CParameterMgr::*RemoteCommandParser)(const IRemoteCommand& remoteCommand, string& strResult); // Parser descriptions @@ -79,9 +81,12 @@ class CParameterMgr : private CElement const char* _pcDescription; }; // Version - static const uint32_t guiEditionMajor = 0x1; - static const uint32_t guiEditionMinor = 0x1; + static const uint32_t guiEditionMajor = 0x2; + static const uint32_t guiEditionMinor = 0x0; static const uint32_t guiRevision = 0x0; + + // Parameter handle friendship + friend class CParameterHandle; public: // Logger interface class ILogger @@ -111,8 +116,7 @@ public: bool applyConfigurations(string& strError); // Dynamic parameter handling - bool setValue(const string& strPath, const string& strValue, bool bRawValueSpace, string& strError); - bool getValue(const string& strPath, string& strValue, bool bRawValueSpace, bool bHexOutputRawFormat, string& strError) const; + CParameterHandle* createParameterHandle(const string& strPath, string& strError); //////////// Tuning ///////////// // Tuning mode @@ -133,8 +137,7 @@ public: bool sync(string& strError); // User set/get parameters - bool setValue(const string& strPath, const string& strValue, string& strError); - bool getValue(const string& strPath, string& strValue, string& strError) const; + bool accessValue(const string& strPath, string& strValue, bool bSet, string& strError); ////////// Configuration/Domains handling ////////////// // Creation/Deletion @@ -242,8 +245,14 @@ private: // For tuning, check we're in tuning mode bool checkTuningModeOn(string& strError) const; + // Blackboard (dynamic parameter handling) + pthread_mutex_t* getBlackboardMutex(); + + // Blackboard reference (dynamic parameter handling) + CParameterBlackboard* getParameterBlackboard(); + // Parameter access - bool doSetValue(const string& strPath, const string& strValue, bool bRawValueSpace, bool bDynamicAccess, string& strError); + bool doSetValue(const string& strPath, const string& strValue, bool bRawValueSpace, bool bDynamicAccess, string& strError) const; bool doGetValue(const string& strPath, string& strValue, bool bRawValueSpace, bool bHexOutputRawFormat, bool bDynamicAccess, string& strError) const; // Framework global configuration loading @@ -328,8 +337,8 @@ private: // Maximum command usage length uint32_t _uiMaxCommandUsageLength; - // Tuning mode mutex - pthread_mutex_t _tuningModeMutex; + // Blackboard access mutex + pthread_mutex_t _blackboardMutex; // Logging ILogger* _pLogger; |