diff options
author | Patrick Benavoli <patrickx.benavoli@intel.com> | 2011-11-10 23:21:01 +0100 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-10 17:15:00 +0100 |
commit | 6ccab9d382c08323fb1f000d859a696f05719c92 (patch) | |
tree | 5f1adc9bed60036317aa940e3baa723a86f22909 | |
parent | 95ac034b72580306e9246f7efa3f7ba709a02183 (diff) | |
download | external_parameter-framework-6ccab9d382c08323fb1f000d859a696f05719c92.zip external_parameter-framework-6ccab9d382c08323fb1f000d859a696f05719c92.tar.gz external_parameter-framework-6ccab9d382c08323fb1f000d859a696f05719c92.tar.bz2 |
PFW: Virtual subsystems
BZ: 14587
- Added the possibility to declare parameters which have no real hardware
implementation. They are only intended to configure the hosting platform.
- A new subsystem type "Virtual" has been introduced to support those
hardwareless parameters.
- Virtual subsystems need no Mapping declaration in the structure
description
Change-Id: I44115f0dd0a26af74a544c6f08473b200aad94d3
Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com>
Reviewed-on: http://android.intel.com:8080/25405
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>
-rw-r--r-- | parameter/Android.mk | 4 | ||||
-rw-r--r-- | parameter/ArrayParameter.cpp | 2 | ||||
-rw-r--r-- | parameter/ArrayParameter.h | 2 | ||||
-rw-r--r-- | parameter/BitParameterBlock.cpp | 2 | ||||
-rw-r--r-- | parameter/BitParameterBlock.h | 2 | ||||
-rw-r--r-- | parameter/ConfigurableElement.cpp | 2 | ||||
-rw-r--r-- | parameter/ConfigurableElement.h | 2 | ||||
-rw-r--r-- | parameter/Parameter.cpp | 2 | ||||
-rw-r--r-- | parameter/Parameter.h | 2 | ||||
-rw-r--r-- | parameter/StringParameter.cpp | 2 | ||||
-rw-r--r-- | parameter/StringParameter.h | 2 | ||||
-rw-r--r-- | parameter/Subsystem.cpp | 2 | ||||
-rw-r--r-- | parameter/Subsystem.h | 2 | ||||
-rw-r--r-- | parameter/SystemClass.cpp | 5 | ||||
-rw-r--r-- | parameter/VirtualSubsystem.cpp | 50 | ||||
-rw-r--r-- | parameter/VirtualSubsystem.h | 49 | ||||
-rw-r--r-- | parameter/VirtualSyncer.cpp | 52 | ||||
-rw-r--r-- | parameter/VirtualSyncer.h | 46 |
18 files changed, 217 insertions, 13 deletions
diff --git a/parameter/Android.mk b/parameter/Android.mk index 57bbe96..aba82af 100644 --- a/parameter/Android.mk +++ b/parameter/Android.mk @@ -85,7 +85,9 @@ LOCAL_SRC_FILES:= \ AutoLock.cpp \ StringParameterType.cpp \ StringParameter.cpp \ - EnumParameterType.cpp + EnumParameterType.cpp \ + VirtualSubsystem.cpp \ + VirtualSyncer.cpp LOCAL_MODULE:= libparameter diff --git a/parameter/ArrayParameter.cpp b/parameter/ArrayParameter.cpp index e777c61..3877e79 100644 --- a/parameter/ArrayParameter.cpp +++ b/parameter/ArrayParameter.cpp @@ -171,7 +171,7 @@ void CArrayParameter::logValue(string& strValue, CErrorContext& errorContext) co getValues(0, strValue, parameterContext); } -// Used for simulation only +// Used for simulation and virtual subsystems void CArrayParameter::setDefaultValues(CParameterAccessContext& parameterAccessContext) const { // Get default value from type diff --git a/parameter/ArrayParameter.h b/parameter/ArrayParameter.h index 9ee1be0..3816652 100644 --- a/parameter/ArrayParameter.h +++ b/parameter/ArrayParameter.h @@ -47,7 +47,7 @@ protected: virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const; virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const; virtual void logValue(string& strValue, CErrorContext& errorContext) const; - // Used for simulation only + // Used for simulation and virtual subsystems virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const; // Element properties diff --git a/parameter/BitParameterBlock.cpp b/parameter/BitParameterBlock.cpp index d169fed..d8b4411 100644 --- a/parameter/BitParameterBlock.cpp +++ b/parameter/BitParameterBlock.cpp @@ -56,7 +56,7 @@ uint32_t CBitParameterBlock::getSize() const return static_cast<const CBitParameterBlockType*>(getTypeElement())->getSize(); } -// Used for simulation only +// Used for simulation and virtual subsystems void CBitParameterBlock::setDefaultValues(CParameterAccessContext& parameterAccessContext) const { // Get default value from type diff --git a/parameter/BitParameterBlock.h b/parameter/BitParameterBlock.h index c58859f..1082c78 100644 --- a/parameter/BitParameterBlock.h +++ b/parameter/BitParameterBlock.h @@ -46,7 +46,7 @@ public: // Size uint32_t getSize() const; - // Used for simulation only + // Used for simulation and virtual subsystems virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const; }; diff --git a/parameter/ConfigurableElement.cpp b/parameter/ConfigurableElement.cpp index b11b84f..c5d97f8 100644 --- a/parameter/ConfigurableElement.cpp +++ b/parameter/ConfigurableElement.cpp @@ -173,7 +173,7 @@ bool CConfigurableElement::getValue(CPathNavigator& pathNavigator, string& strVa return pChild->getValue(pathNavigator, strValue, parameterContext); } -// Used for simulation only +// Used for simulation and virtual subsystems void CConfigurableElement::setDefaultValues(CParameterAccessContext& parameterAccessContext) const { // Propagate to children diff --git a/parameter/ConfigurableElement.h b/parameter/ConfigurableElement.h index 4cb2d72..57eb3a5 100644 --- a/parameter/ConfigurableElement.h +++ b/parameter/ConfigurableElement.h @@ -88,7 +88,7 @@ public: // Parameter access virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const; virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const; - // Used for simulation only + // Used for simulation and virtual subsystems virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const; // Element properties diff --git a/parameter/Parameter.cpp b/parameter/Parameter.cpp index 7242e0d..1770d9a 100644 --- a/parameter/Parameter.cpp +++ b/parameter/Parameter.cpp @@ -73,7 +73,7 @@ uint32_t CParameter::getSize() const return static_cast<const CParameterType*>(getTypeElement())->getSize(); } -// Used for simulation only +// Used for simulation and virtual subsystems void CParameter::setDefaultValues(CParameterAccessContext& parameterAccessContext) const { // Get default value from type diff --git a/parameter/Parameter.h b/parameter/Parameter.h index 50a8999..175836c 100644 --- a/parameter/Parameter.h +++ b/parameter/Parameter.h @@ -48,7 +48,7 @@ public: // XML configuration settings parsing/composing virtual bool serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const; protected: - // Used for simulation only + // Used for simulation and virtual subsystems virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const; // Actual value access diff --git a/parameter/StringParameter.cpp b/parameter/StringParameter.cpp index 5040379..5d01f76 100644 --- a/parameter/StringParameter.cpp +++ b/parameter/StringParameter.cpp @@ -56,7 +56,7 @@ uint32_t CStringParameter::getSize() const return static_cast<const CStringParameterType*>(getTypeElement())->getMaxLength() + 1; } -// Used for simulation only +// Used for simulation and virtual subsystems void CStringParameter::setDefaultValues(CParameterAccessContext& parameterAccessContext) const { // Write blackboard diff --git a/parameter/StringParameter.h b/parameter/StringParameter.h index 8ed1c5b..f536ceb 100644 --- a/parameter/StringParameter.h +++ b/parameter/StringParameter.h @@ -45,7 +45,7 @@ public: // Type virtual Type getType() const; protected: - // Used for simulation only + // Used for simulation and virtual subsystems virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const; // Actual value access diff --git a/parameter/Subsystem.cpp b/parameter/Subsystem.cpp index e17a80d..5f09d6c 100644 --- a/parameter/Subsystem.cpp +++ b/parameter/Subsystem.cpp @@ -182,7 +182,7 @@ void CSubsystem::logValue(string& strValue, CErrorContext& errorContext) const return base::logValue(strValue, errorContext); } -// Used for simulation only +// Used for simulation and virtual subsystems void CSubsystem::setDefaultValues(CParameterAccessContext& parameterAccessContext) const { // Deal with Endianness diff --git a/parameter/Subsystem.h b/parameter/Subsystem.h index 12f6ed0..9be5de4 100644 --- a/parameter/Subsystem.h +++ b/parameter/Subsystem.h @@ -65,7 +65,7 @@ protected: virtual bool setValue(CPathNavigator& pathNavigator, const string& strValue, CParameterAccessContext& parameterContext) const; virtual bool getValue(CPathNavigator& pathNavigator, string& strValue, CParameterAccessContext& parameterContext) const; virtual void logValue(string& strValue, CErrorContext& errorContext) const; - // Used for simulation only + // Used for simulation and virtual subsystems virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const; /// Functionality intendedn for derived Subsystems diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp index 6443e2c..97fc89f 100644 --- a/parameter/SystemClass.cpp +++ b/parameter/SystemClass.cpp @@ -35,6 +35,8 @@ #include "SystemClass.h" #include "SubsystemLibrary.h" #include "AutoLog.h" +#include "VirtualSubsystem.h" +#include "NamedElementBuilderTemplate.h" #define base CConfigurableElement @@ -160,6 +162,9 @@ bool CSystemClass::loadSubsystems(string& strError, const vector<string>& astrPl pfnGetSusbystemBuilder(_pSubsystemLibrary); } + // Add virtual subsystem builder + _pSubsystemLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CVirtualSubsystem>("Virtual")); + return true; } diff --git a/parameter/VirtualSubsystem.cpp b/parameter/VirtualSubsystem.cpp new file mode 100644 index 0000000..ee06fe5 --- /dev/null +++ b/parameter/VirtualSubsystem.cpp @@ -0,0 +1,50 @@ +/* <auto_header> + * <FILENAME> + * + * INTEL CONFIDENTIAL + * Copyright © 2011 Intel + * Corporation All Rights Reserved. + * + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Intel Corporation or its suppliers + * or licensors. Title to the Material remains with Intel Corporation or its + * suppliers and licensors. The Material contains trade secrets and proprietary + * and confidential information of Intel or its suppliers and licensors. The + * Material is protected by worldwide copyright and trade secret laws and + * treaty provisions. No part of the Material may be used, copied, reproduced, + * modified, published, uploaded, posted, transmitted, distributed, or + * disclosed in any way without Intel’s prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Intel in writing. + * + * AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com) + * CREATED: 2011-06-01 + * UPDATED: 2011-07-27 + * + * + * </auto_header> + */ +#include "VirtualSubsystem.h" +#include "VirtualSyncer.h" + +#define base CSubsystem + +CVirtualSubsystem::CVirtualSubsystem(const string& strName) + : base(strName), _pVirtualSyncer(new CVirtualSyncer(this)) +{ +} + +CVirtualSubsystem::~CVirtualSubsystem() +{ + delete _pVirtualSyncer; +} + +// Syncer +ISyncer* CVirtualSubsystem::getSyncer() const +{ + return _pVirtualSyncer; +} diff --git a/parameter/VirtualSubsystem.h b/parameter/VirtualSubsystem.h new file mode 100644 index 0000000..2f3cc6e --- /dev/null +++ b/parameter/VirtualSubsystem.h @@ -0,0 +1,49 @@ +/* <auto_header> + * <FILENAME> + * + * INTEL CONFIDENTIAL + * Copyright © 2011 Intel + * Corporation All Rights Reserved. + * + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Intel Corporation or its suppliers + * or licensors. Title to the Material remains with Intel Corporation or its + * suppliers and licensors. The Material contains trade secrets and proprietary + * and confidential information of Intel or its suppliers and licensors. The + * Material is protected by worldwide copyright and trade secret laws and + * treaty provisions. No part of the Material may be used, copied, reproduced, + * modified, published, uploaded, posted, transmitted, distributed, or + * disclosed in any way without Intel’s prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Intel in writing. + * + * AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com) + * CREATED: 2011-06-01 + * UPDATED: 2011-07-27 + * + * + * </auto_header> + */ +#pragma once + +#include "Subsystem.h" + +class CVirtualSyncer; + +class CVirtualSubsystem : public CSubsystem +{ +public: + CVirtualSubsystem(const string& strName); + virtual ~CVirtualSubsystem(); + +protected: + // Syncer + virtual ISyncer* getSyncer() const; + +private: + CVirtualSyncer* _pVirtualSyncer; +}; diff --git a/parameter/VirtualSyncer.cpp b/parameter/VirtualSyncer.cpp new file mode 100644 index 0000000..32f19a9 --- /dev/null +++ b/parameter/VirtualSyncer.cpp @@ -0,0 +1,52 @@ +/* <auto_header> + * <FILENAME> + * + * INTEL CONFIDENTIAL + * Copyright © 2011 Intel + * Corporation All Rights Reserved. + * + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Intel Corporation or its suppliers + * or licensors. Title to the Material remains with Intel Corporation or its + * suppliers and licensors. The Material contains trade secrets and proprietary + * and confidential information of Intel or its suppliers and licensors. The + * Material is protected by worldwide copyright and trade secret laws and + * treaty provisions. No part of the Material may be used, copied, reproduced, + * modified, published, uploaded, posted, transmitted, distributed, or + * disclosed in any way without Intel’s prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Intel in writing. + * + * AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com) + * CREATED: 2011-06-01 + * UPDATED: 2011-07-27 + * + * + * </auto_header> + */ +#include "VirtualSyncer.h" +#include "ConfigurableElement.h" +#include "ParameterAccessContext.h" + +CVirtualSyncer::CVirtualSyncer(const CConfigurableElement* pConfigurableElement) : _pConfigurableElement(pConfigurableElement) +{ +} + +// Synchronization +bool CVirtualSyncer::sync(CParameterBlackboard& parameterBlackboard, bool bBack, string& strError) +{ + // Synchronize to/from HW + if (bBack) { + // Create access context + CParameterAccessContext parameterAccessContext(strError, ¶meterBlackboard, false); + + // Just implement back synchronization with default values + _pConfigurableElement->setDefaultValues(parameterAccessContext); + } + + return true; +} diff --git a/parameter/VirtualSyncer.h b/parameter/VirtualSyncer.h new file mode 100644 index 0000000..c5f7c95 --- /dev/null +++ b/parameter/VirtualSyncer.h @@ -0,0 +1,46 @@ +/* <auto_header> + * <FILENAME> + * + * INTEL CONFIDENTIAL + * Copyright © 2011 Intel + * Corporation All Rights Reserved. + * + * The source code contained or described herein and all documents related to + * the source code ("Material") are owned by Intel Corporation or its suppliers + * or licensors. Title to the Material remains with Intel Corporation or its + * suppliers and licensors. The Material contains trade secrets and proprietary + * and confidential information of Intel or its suppliers and licensors. The + * Material is protected by worldwide copyright and trade secret laws and + * treaty provisions. No part of the Material may be used, copied, reproduced, + * modified, published, uploaded, posted, transmitted, distributed, or + * disclosed in any way without Intel’s prior express written permission. + * + * No license under any patent, copyright, trade secret or other intellectual + * property right is granted to or conferred upon you by disclosure or delivery + * of the Materials, either expressly, by implication, inducement, estoppel or + * otherwise. Any license under such intellectual property rights must be + * express and approved by Intel in writing. + * + * AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com) + * CREATED: 2011-06-01 + * UPDATED: 2011-07-27 + * + * + * </auto_header> + */ +#pragma once + +#include "Syncer.h" + +class CConfigurableElement; + +class CVirtualSyncer : public ISyncer +{ +public: + CVirtualSyncer(const CConfigurableElement* pConfigurableElement); + + // from ISyncer + virtual bool sync(CParameterBlackboard& parameterBlackboard, bool bBack, string& strError); +private: + const CConfigurableElement* _pConfigurableElement; +}; |