parameter-framework: improvements and corrections
BZ: 6721
- Bug correction concerning selection criteria display (inclusive type)
- Adapted XML format to allow for only on parameter to be associated to
a domain
- Removed unused files in parameter project
Change-Id: I9f42d08ff8cb60354714fe3d6b0f0b321ad0a7bf
Orig-Change-Id: I837e553070f5acf2d275082c986ba29433493e31
Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com>
Reviewed-on: http://android.intel.com:8080/16878
Reviewed-by: Mahe, Erwan <erwan.mahe@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp
index fb53520..f0f1985 100644
--- a/parameter/SubsystemObject.cpp
+++ b/parameter/SubsystemObject.cpp
@@ -32,9 +32,15 @@
#include "InstanceConfigurableElement.h"
#include "ParameterBlackboard.h"
#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sstream>
CSubsystemObject::CSubsystemObject(CInstanceConfigurableElement* pInstanceConfigurableElement)
- : _pInstanceConfigurableElement(pInstanceConfigurableElement), _uiDataSize(pInstanceConfigurableElement->getFootPrint()), _pvSynchronizedLocation(NULL)
+ : _pInstanceConfigurableElement(pInstanceConfigurableElement),
+ _uiDataSize(pInstanceConfigurableElement->getFootPrint()),
+ _pucBlackboardLocation(NULL),
+ _uiAccessedIndex(0)
{
// Syncer
_pInstanceConfigurableElement->setSyncer(this);
@@ -45,10 +51,10 @@
_pInstanceConfigurableElement->unsetSyncer();
}
-// Synchronized location
-void CSubsystemObject::setSynchronizedLocation(void* pvSynchronizedLocation)
+// Blackboard data location
+uint8_t* CSubsystemObject::getBlackboardLocation() const
{
- _pvSynchronizedLocation = pvSynchronizedLocation;
+ return _pucBlackboardLocation;
}
// Size
@@ -57,10 +63,28 @@
return _uiDataSize;
}
+// Conversion utility
+uint32_t CSubsystemObject::asInteger(const string& strValue)
+{
+ return strtoul(strValue.c_str(), NULL, 0);
+}
+
+string CSubsystemObject::asString(uint32_t uiValue)
+{
+ ostringstream ostr;
+
+ ostr << uiValue;
+
+ return ostr.str();
+}
+
// Synchronization
bool CSubsystemObject::sync(CParameterBlackboard& parameterBlackboard, bool bBack, string& strError)
{
- assert(_pvSynchronizedLocation);
+ // Get blackboard location
+ _pucBlackboardLocation = parameterBlackboard.getLocation(_pInstanceConfigurableElement->getOffset());
+ // Access index init
+ _uiAccessedIndex = 0;
#ifdef SIMULATION
return true;
@@ -70,28 +94,69 @@
if (bBack) {
// Read from HW
- if (!receiveFromHW()) {
+ if (!accessHW(true, strError)) {
- strError = "Unable to back synchronize configurable element " + _pInstanceConfigurableElement->getPath();
+ strError = "Unable to back synchronize configurable element " + _pInstanceConfigurableElement->getPath() + ": " + strError;
return false;
}
- // Write parameter block data
- parameterBlackboard.rawWrite(_pvSynchronizedLocation, _uiDataSize, _pInstanceConfigurableElement->getOffset());
-
} else {
- // Read parameter block data
- parameterBlackboard.rawRead(_pvSynchronizedLocation, _uiDataSize, _pInstanceConfigurableElement->getOffset());
-
// Send to HW
- if (!sendToHW()) {
+ if (!accessHW(false, strError)) {
- strError = "Unable to synchronize configurable element " + _pInstanceConfigurableElement->getPath();
+ strError = "Unable to synchronize configurable element " + _pInstanceConfigurableElement->getPath() + ": " + strError;
return false;
}
}
return true;
}
+
+// Sync to/from HW
+bool CSubsystemObject::sendToHW(string& strError)
+{
+ strError = "Send to HW interface not implemented at subsystsem level!";
+
+ return false;
+}
+
+bool CSubsystemObject::receiveFromHW(string& strError)
+{
+ strError = "Receive from HW interface not implemented at subsystsem level!";
+
+ return false;
+}
+
+// Fall back HW access
+bool CSubsystemObject::accessHW(bool bReceive, string& strError)
+{
+ // Default access falls back
+ if (bReceive) {
+
+ return receiveFromHW(strError);
+ } else {
+
+ return sendToHW(strError);
+ }
+}
+
+// Blackboard access from subsystems
+void CSubsystemObject::blackboardRead(void* pvData, uint32_t uiSize)
+{
+ assert(_uiAccessedIndex + uiSize <= _uiDataSize);
+
+ memcpy(pvData, _pucBlackboardLocation + _uiAccessedIndex, uiSize);
+
+ _uiAccessedIndex += uiSize;
+}
+
+void CSubsystemObject::blackboardWrite(const void* pvData, uint32_t uiSize)
+{
+ assert(_uiAccessedIndex + uiSize <= _uiDataSize);
+
+ memcpy(_pucBlackboardLocation + _uiAccessedIndex, pvData, uiSize);
+
+ _uiAccessedIndex += uiSize;
+}