Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1 | /* <auto_header> |
| 2 | * <FILENAME> |
| 3 | * |
| 4 | * INTEL CONFIDENTIAL |
| 5 | * Copyright © 2011 Intel |
| 6 | * Corporation All Rights Reserved. |
| 7 | * |
| 8 | * The source code contained or described herein and all documents related to |
| 9 | * the source code ("Material") are owned by Intel Corporation or its suppliers |
| 10 | * or licensors. Title to the Material remains with Intel Corporation or its |
| 11 | * suppliers and licensors. The Material contains trade secrets and proprietary |
| 12 | * and confidential information of Intel or its suppliers and licensors. The |
| 13 | * Material is protected by worldwide copyright and trade secret laws and |
| 14 | * treaty provisions. No part of the Material may be used, copied, reproduced, |
| 15 | * modified, published, uploaded, posted, transmitted, distributed, or |
| 16 | * disclosed in any way without Intel’s prior express written permission. |
| 17 | * |
| 18 | * No license under any patent, copyright, trade secret or other intellectual |
| 19 | * property right is granted to or conferred upon you by disclosure or delivery |
| 20 | * of the Materials, either expressly, by implication, inducement, estoppel or |
| 21 | * otherwise. Any license under such intellectual property rights must be |
| 22 | * express and approved by Intel in writing. |
| 23 | * |
| 24 | * AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com) |
| 25 | * CREATED: 2011-06-01 |
| 26 | * UPDATED: 2011-07-27 |
| 27 | * |
| 28 | * |
| 29 | * </auto_header> |
| 30 | */ |
| 31 | #include "ParameterMgr.h" |
| 32 | #include "XmlParser.h" |
| 33 | #include "XmlParameterSerializingContext.h" |
| 34 | #include "XmlElementSerializingContext.h" |
| 35 | #include "SystemClass.h" |
| 36 | #include "ElementLibrarySet.h" |
| 37 | #include "SubsystemLibrary.h" |
| 38 | #include "NamedElementBuilderTemplate.h" |
| 39 | #include "KindElementBuilderTemplate.h" |
| 40 | #include "ElementBuilderTemplate.h" |
| 41 | #include "SelectionCriterionType.h" |
| 42 | #include "SelectionCriterionDefinition.h" |
| 43 | #include "SubsystemElementBuilder.h" |
| 44 | #include "SelectionCriteria.h" |
| 45 | #include "ComponentType.h" |
| 46 | #include "ComponentInstance.h" |
| 47 | #include "ParameterBlockType.h" |
| 48 | #include "BooleanParameterType.h" |
| 49 | #include "IntegerParameterType.h" |
| 50 | #include "FixedPointParameterType.h" |
| 51 | #include "ParameterBlackboard.h" |
| 52 | #include "Parameter.h" |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 53 | #include "ParameterBlackboard.h" |
| 54 | #include "ParameterAccessContext.h" |
| 55 | #include "XmlFileIncluderElement.h" |
| 56 | #include "ParameterFrameworkConfiguration.h" |
| 57 | #include "FrameworkConfigurationGroup.h" |
| 58 | #include "FrameworkConfigurationLocation.h" |
| 59 | #include "SystemClassConfiguration.h" |
| 60 | #include "ConfigurableDomains.h" |
| 61 | #include "ConfigurableDomain.h" |
| 62 | #include "DomainConfiguration.h" |
| 63 | #include "XmlComposer.h" |
| 64 | #include "XmlDomainSerializingContext.h" |
| 65 | #include "BitParameterBlockType.h" |
| 66 | #include "BitParameterType.h" |
| 67 | #include "RemoteProcessorServerInterface.h" |
| 68 | #include "ElementLocator.h" |
| 69 | #include "AutoLog.h" |
| 70 | #include "CompoundRule.h" |
| 71 | #include "SelectionCriterionRule.h" |
| 72 | #include "SimulatedBackSynchronizer.h" |
| 73 | #include "HardwareBackSynchronizer.h" |
| 74 | #include <strings.h> |
| 75 | #include <dlfcn.h> |
| 76 | #include <assert.h> |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 77 | |
| 78 | #define base CElement |
| 79 | |
| 80 | // Used for remote processor server creation |
| 81 | typedef IRemoteProcessorServerInterface* (*CreateRemoteProcessorServer)(uint16_t uiPort, IRemoteCommandHandler* pCommandHandler); |
| 82 | |
| 83 | // Global configuration file name (fixed) |
| 84 | const char* gacParameterFrameworkConfigurationFileName = "ParameterFrameworkConfiguration.xml"; |
| 85 | const char* gacSystemSchemasSubFolder = "Schemas"; |
| 86 | |
| 87 | // Config File System looks normally like this: |
| 88 | // --------------------------------------------- |
| 89 | //├── ParameterFrameworkConfiguration.xml |
| 90 | //├── Schemas |
| 91 | //│ └── *.xsd |
| 92 | //├── Settings |
| 93 | //│ └── <SystemClassName folder>* |
| 94 | //│ ├── <ConfigurableDomains>.xml |
| 95 | //│ └── <Settings>.bin? |
| 96 | //└── Structure |
| 97 | // └── <SystemClassName folder>* |
| 98 | // ├── <SystemClassName>Class.xml |
| 99 | // └── <Subsystem>.xml* |
| 100 | // -------------------------------------------- |
| 101 | |
| 102 | |
| 103 | // Remote command parser array |
| 104 | const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gaRemoteCommandParserItems[] = { |
| 105 | /// Help |
| 106 | { "help", &CParameterMgr::helpCommandProcess, 0, "", "Show commands description and usage" }, |
| 107 | /// Status |
| 108 | { "status", &CParameterMgr::statusCommandProcess, 0, "", "Show current status" }, |
| 109 | /// Tuning Mode |
| 110 | { "setTuningMode", &CParameterMgr::setTuningModeCommmandProcess, 1, "on|off*", "Turn on or off Tuning Mode" }, |
| 111 | { "getTuningMode", &CParameterMgr::getTuningModeCommmandProcess, 0, "", "Show Tuning Mode" }, |
| 112 | /// Value Space |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 113 | { "setValueSpace", &CParameterMgr::setValueSpaceCommmandProcess, 1, "raw|real*", "Assigns Value Space used for parameter value interpretation" }, |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 114 | { "getValueSpace", &CParameterMgr::getValueSpaceCommmandProcess, 0, "", "Show Value Space" }, |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 115 | /// Output Raw Format |
| 116 | { "setOutputRawFormat", &CParameterMgr::setOutputRawFormatCommmandProcess, 1, "dec*|hex", "Assigns format used to output parameter values when in raw Value Space" }, |
| 117 | { "getOutputRawFormat", &CParameterMgr::getOutputRawFormatCommmandProcess, 0, "", "Show Output Raw Format" }, |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 118 | /// Sync |
| 119 | { "setAutoSync", &CParameterMgr::setAutoSyncCommmandProcess, 1, "on*|off", "Turn on or off automatic synchronization to hardware while in Tuning Mode" }, |
| 120 | { "getAutoSync", &CParameterMgr::getAutoSyncCommmandProcess, 0, "", "Show Auto Sync state" }, |
| 121 | { "sync", &CParameterMgr::syncCommmandProcess, 0, "", "Synchronize current settings to hardware while in Tuning Mode and Auto Sync off" }, |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 122 | /// Criteria |
| 123 | { "listCriteria", &CParameterMgr::listCriteriaCommmandProcess, 0, "", "List available selection criteria" }, |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 124 | /// Domains |
| 125 | { "listDomains", &CParameterMgr::listDomainsCommmandProcess, 0, "", "List configurable domains" }, |
| 126 | { "createDomain", &CParameterMgr::createDomainCommmandProcess, 1, "<domain>", "Create new configurable domain" }, |
| 127 | { "deleteDomain", &CParameterMgr::deleteDomainCommmandProcess, 1, "<domain>", "Delete configurable domain" }, |
| 128 | { "renameDomain", &CParameterMgr::renameDomainCommmandProcess, 2, "<domain> <new name>", "Rename configurable domain" }, |
| 129 | { "listDomainElements", &CParameterMgr::listDomainElementsCommmandProcess, 1, "<domain>", "List elements associated to configurable domain" }, |
| 130 | { "addElement", &CParameterMgr::addElementCommmandProcess, 2, "<domain> <elem path>", "Associate element at given path to configurable domain" }, |
| 131 | { "removeElement", &CParameterMgr::removeElementCommmandProcess, 2, "<domain> <elem path>", "Dissociate element at given path from configurable domain" }, |
| 132 | { "splitDomain", &CParameterMgr::splitDomainCommmandProcess, 2, "<domain> <elem path>", "Split configurable domain at given associated element path" }, |
| 133 | /// Configurations |
| 134 | { "listConfigurations", &CParameterMgr::listConfigurationsCommmandProcess, 1, "<domain>", "List domain configurations" }, |
| 135 | { "createConfiguration", &CParameterMgr::createConfigurationCommmandProcess, 2, "<domain> <configuration>", "Create new domain configuration" }, |
| 136 | { "deleteConfiguration", &CParameterMgr::deleteConfigurationCommmandProcess, 2, "<domain> <configuration>", "Delete domain configuration" }, |
| 137 | { "renameConfiguration", &CParameterMgr::renameConfigurationCommmandProcess, 3, "<domain> <configuration> <new name>", "Rename domain configuration" }, |
| 138 | { "saveConfiguration", &CParameterMgr::saveConfigurationCommmandProcess, 2, "<domain> <configuration>", "Save current settings into configuration" }, |
| 139 | { "restoreConfiguration", &CParameterMgr::restoreConfigurationCommmandProcess, 2, "<domain> <configuration>", "Restore current settings from configuration" }, |
| 140 | /// Elements/Parameters |
| 141 | { "listElements", &CParameterMgr::listElementsCommmandProcess, 1, "<elem path>|/", "List elements under element at given path or root" }, |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 142 | { "listParameters", &CParameterMgr::listParametersCommmandProcess, 1, "<elem path>|/", "Recursively list elements under element at given path or root" }, |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 143 | { "dumpElement", &CParameterMgr::dumpElementCommmandProcess, 1, "<elem path>", "Dump structure and content of element at given path" }, |
| 144 | { "getElementSize", &CParameterMgr::getElementSizeCommmandProcess, 1, "<elem path>", "Show size of element at given path" }, |
Patrick Benavoli | 2ecf900 | 2011-08-31 11:23:24 +0200 | [diff] [blame^] | 145 | { "showProperties", &CParameterMgr::showPropertiesCommmandProcess, 1, "<elem path>", "Show properties of element at given path" }, |
| 146 | { "getParameter", &CParameterMgr::getParameterCommmandProcess, 1, "<param ath>", "Get value for parameter at given path" }, |
| 147 | { "setParameter", &CParameterMgr::setParameterCommmandProcess, 2, "<param path> <value>", "Set value for parameter at given path" }, |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 148 | { "listBelongingDomains", &CParameterMgr::listBelongingDomainsCommmandProcess, 1, "<elem path>", "List domain(s) element at given path is contained in" }, |
| 149 | { "listAssociatedDomains", &CParameterMgr::listAssociatedDomainsCommmandProcess, 1, "<elem path>", "List domain(s) element at given path is associated to" }, |
| 150 | /// Browse |
| 151 | { "listAssociatedElements", &CParameterMgr::listAssociatedElementsCommmandProcess, 0, "", "List element sub-trees associated to at least one configurable domain" }, |
| 152 | { "listConflictingElements", &CParameterMgr::listConflictingElementsCommmandProcess, 0, "", "List element sub-trees contained in more than one configurable domain" }, |
| 153 | { "listRogueElements", &CParameterMgr::listRogueElementsCommmandProcess, 0, "", "List element sub-trees owned by no configurable domain" }, |
| 154 | /// Settings Import/Export |
| 155 | { "exportDomainsXML", &CParameterMgr::exportConfigurableDomainsToXMLCommmandProcess, 1, "<file path> ", "Export domains to XML file" }, |
| 156 | { "importDomainsXML", &CParameterMgr::importConfigurableDomainsFromXMLCommmandProcess, 1, "<file path>", "Import domains from XML file" }, |
| 157 | { "exportDomainsWithSettingsXML", &CParameterMgr::exportConfigurableDomainsWithSettingsToXMLCommmandProcess, 1, "<file path> ", "Export domains including settings to XML file" }, |
| 158 | { "importDomainsWithSettingsXML", &CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess, 1, "<file path>", "Import domains including settings from XML file" }, |
| 159 | { "exportSettings", &CParameterMgr::exportSettingsCommmandProcess, 1, "<file path>", "Export settings to binary file" }, |
| 160 | { "importSettings", &CParameterMgr::importSettingsCommmandProcess, 1, "<file path>", "Import settings from binary file" } |
| 161 | }; |
| 162 | // Remote command parsers array Size |
| 163 | const uint32_t CParameterMgr::guiNbRemoteCommandParserItems = sizeof(gaRemoteCommandParserItems) / sizeof(gaRemoteCommandParserItems[0]); |
| 164 | |
| 165 | CParameterMgr::CParameterMgr(const string& strParameterFrameworkConfigurationFolderPath, const string& strSystemClassName) : |
| 166 | _bTuningModeIsOn(false), |
| 167 | _bValueSpaceIsRaw(false), |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 168 | _bOutputRawFormatIsHex(false), |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 169 | _bAutoSyncOn(true), |
| 170 | _pMainParameterBlackboard(new CParameterBlackboard), |
| 171 | _pElementLibrarySet(new CElementLibrarySet), |
| 172 | _strParameterFrameworkConfigurationFolderPath(strParameterFrameworkConfigurationFolderPath), |
| 173 | _strSchemaFolderLocation(strParameterFrameworkConfigurationFolderPath + "/" + gacSystemSchemasSubFolder), |
| 174 | _pSystemClassConfiguration(NULL), |
| 175 | _uiStructureChecksum(0), |
| 176 | _pRemoteProcessorServer(NULL), |
| 177 | _uiMaxCommandUsageLength(0), |
| 178 | _pLogger(NULL), |
| 179 | _uiLogDepth(0) |
| 180 | { |
| 181 | // Tuning Mode Mutex |
| 182 | bzero(&_tuningModeMutex, sizeof(_tuningModeMutex)); |
| 183 | pthread_mutex_init(&_tuningModeMutex, NULL); |
| 184 | |
| 185 | // Deal with children |
| 186 | addChild(new CParameterFrameworkConfiguration); |
| 187 | addChild(new CSelectionCriteria); |
| 188 | addChild(new CSystemClass(strSystemClassName)); |
| 189 | addChild(new CConfigurableDomains(strSystemClassName)); |
| 190 | |
| 191 | // Feed element library |
| 192 | feedElementLibraries(); |
| 193 | } |
| 194 | |
| 195 | CParameterMgr::~CParameterMgr() |
| 196 | { |
| 197 | // Children |
| 198 | delete _pRemoteProcessorServer; |
| 199 | delete _pMainParameterBlackboard; |
| 200 | delete _pElementLibrarySet; |
| 201 | |
| 202 | // Tuning Mode Mutex |
| 203 | pthread_mutex_destroy(&_tuningModeMutex); |
| 204 | } |
| 205 | |
| 206 | string CParameterMgr::getKind() const |
| 207 | { |
| 208 | return "ParameterMgr"; |
| 209 | } |
| 210 | |
| 211 | // Logging |
| 212 | void CParameterMgr::setLogger(CParameterMgr::ILogger* pLogger) |
| 213 | { |
| 214 | _pLogger = pLogger; |
| 215 | } |
| 216 | |
| 217 | // Logging |
| 218 | void CParameterMgr::doLog(const string& strLog) const |
| 219 | { |
| 220 | if (_pLogger) { |
| 221 | |
| 222 | // Nest |
| 223 | string strIndent; |
| 224 | |
| 225 | // Level |
| 226 | uint32_t uiNbIndents = _uiLogDepth; |
| 227 | |
| 228 | while (uiNbIndents--) { |
| 229 | |
| 230 | strIndent += " "; |
| 231 | } |
| 232 | |
| 233 | // Log |
| 234 | _pLogger->log(strIndent + strLog); |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | void CParameterMgr::nestLog() const |
| 239 | { |
| 240 | ((uint32_t&)_uiLogDepth)++; |
| 241 | } |
| 242 | |
| 243 | void CParameterMgr::unnestLog() const |
| 244 | { |
| 245 | ((uint32_t&)_uiLogDepth)--; |
| 246 | } |
| 247 | |
| 248 | bool CParameterMgr::load(string& strError) |
| 249 | { |
| 250 | CAutoLog autoLog(this, "Loading"); |
| 251 | |
| 252 | // Load Framework configuration |
| 253 | if (!loadFrameworkConfiguration(strError)) { |
| 254 | |
| 255 | return false; |
| 256 | } |
| 257 | |
| 258 | // Load subsystems |
| 259 | if (!getSystemClass()->loadSubsystems(strError, _astrPluginFolderPaths)) { |
| 260 | |
| 261 | return false; |
| 262 | } |
| 263 | |
| 264 | // Load structure |
| 265 | if (!loadStructure(strError)) { |
| 266 | |
| 267 | return false; |
| 268 | } |
| 269 | |
| 270 | // Load settings |
| 271 | if (!loadSettings(strError)) { |
| 272 | |
| 273 | return false; |
| 274 | } |
| 275 | |
| 276 | // All is loaded, we're ready to observe selection criteria events |
| 277 | getSelectionCriteria()->setObserver(this); |
| 278 | |
| 279 | // Load and start Remote processor server if appropriate |
| 280 | if (!handleRemoteProcessingInterface(strError)) { |
| 281 | |
| 282 | return false; |
| 283 | } |
| 284 | |
| 285 | return true; |
| 286 | } |
| 287 | |
| 288 | bool CParameterMgr::loadFrameworkConfiguration(string& strError) |
| 289 | { |
| 290 | CAutoLog autoLog(this, "Loading framework configuration"); |
| 291 | |
| 292 | // Get Xml config file name |
| 293 | string strXmlConfigurationFilePath = _strParameterFrameworkConfigurationFolderPath + "/" + gacParameterFrameworkConfigurationFileName; |
| 294 | |
| 295 | // Parse Structure XML file |
| 296 | CXmlElementSerializingContext elementSerializingContext(strError); |
| 297 | |
| 298 | if (!xmlParse(elementSerializingContext, getFrameworkConfiguration(), strXmlConfigurationFilePath, _strParameterFrameworkConfigurationFolderPath, EFrameworkConfigurationLibrary)) { |
| 299 | |
| 300 | return false; |
| 301 | } |
| 302 | // Get subsystem plugins folders element |
| 303 | const CFrameworkConfigurationGroup* pSubsystemPluginFolders= static_cast<const CFrameworkConfigurationGroup*>(getConstFrameworkConfiguration()->findChild("SubsystemPluginFolders")); |
| 304 | |
| 305 | if (!pSubsystemPluginFolders) { |
| 306 | |
| 307 | strError = "Parameter Framework Configuration: couldn't find SubsystemPluginFolders element"; |
| 308 | |
| 309 | return false; |
| 310 | } |
| 311 | // Get plugin locations |
| 312 | uint32_t uiPluginFolderLocation; |
| 313 | uint32_t uiNbPluginFolderLocations = pSubsystemPluginFolders->getNbChildren(); |
| 314 | |
| 315 | if (!uiNbPluginFolderLocations) { |
| 316 | |
| 317 | strError = "Parameter Framework Configuration: couldn't find any PluginFolderLocation element"; |
| 318 | |
| 319 | return false; |
| 320 | } |
| 321 | |
| 322 | for (uiPluginFolderLocation = 0; uiPluginFolderLocation < uiNbPluginFolderLocations; uiPluginFolderLocation++) { |
| 323 | |
| 324 | const CFrameworkConfigurationLocation* pSubsystemPluginLocation = static_cast<const CFrameworkConfigurationLocation*>(pSubsystemPluginFolders->getChild(uiPluginFolderLocation)); |
| 325 | |
| 326 | _astrPluginFolderPaths.push_back(pSubsystemPluginLocation->getFilePath(_strParameterFrameworkConfigurationFolderPath)); |
| 327 | } |
| 328 | |
| 329 | // Get configuration for current system class |
| 330 | const CFrameworkConfigurationGroup* pParameterConfigurationGroup = static_cast<const CFrameworkConfigurationGroup*>(getConstFrameworkConfiguration()->findChildOfKind("ParameterConfiguration")); |
| 331 | |
| 332 | if (!pParameterConfigurationGroup) { |
| 333 | |
| 334 | strError = "Parameter Framework Configuration: couldn't find ParameterConfiguration element"; |
| 335 | |
| 336 | return false; |
| 337 | } |
| 338 | _pSystemClassConfiguration = static_cast<const CSystemClassConfiguration*>(pParameterConfigurationGroup->findChild(getSystemClass()->getName())); |
| 339 | |
| 340 | if (!_pSystemClassConfiguration) { |
| 341 | |
| 342 | strError = "No framework configuration found for SystemClass " + getSystemClass()->getName(); |
| 343 | |
| 344 | return false; |
| 345 | } |
| 346 | // Log tuning availability |
| 347 | log("Tuning %s", _pSystemClassConfiguration->isTuningAllowed() ? "allowed" : "prohibited"); |
| 348 | |
| 349 | return true; |
| 350 | } |
| 351 | |
| 352 | bool CParameterMgr::loadStructure(string& strError) |
| 353 | { |
| 354 | // Retrieve system to load structure to |
| 355 | CSystemClass* pSystemClass = getSystemClass(); |
| 356 | |
| 357 | CAutoLog autoLog(this, "Loading " + pSystemClass->getName() + " system class structure"); |
| 358 | |
| 359 | // Get structure description element |
| 360 | const CFrameworkConfigurationLocation* pStructureDescriptionFileLocation = static_cast<const CFrameworkConfigurationLocation*>(_pSystemClassConfiguration->findChildOfKind("StructureDescriptionFileLocation")); |
| 361 | |
| 362 | if (!pStructureDescriptionFileLocation) { |
| 363 | |
| 364 | strError = "No StructureDescriptionFileLocation element found for SystemClass " + pSystemClass->getName(); |
| 365 | |
| 366 | return false; |
| 367 | } |
| 368 | |
| 369 | // Get Xml structure folder |
| 370 | string strXmlStructureFolder = pStructureDescriptionFileLocation->getFolderPath(_strParameterFrameworkConfigurationFolderPath); |
| 371 | |
| 372 | // Get Xml structure file name |
| 373 | string strXmlStructureFilePath = pStructureDescriptionFileLocation->getFilePath(_strParameterFrameworkConfigurationFolderPath); |
| 374 | |
| 375 | // Parse Structure XML file |
| 376 | CXmlParameterSerializingContext parameterBuildContext(strError); |
| 377 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 378 | log("Importing system structure from file %s", strXmlStructureFilePath.c_str()); |
| 379 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 380 | if (!xmlParse(parameterBuildContext, pSystemClass, strXmlStructureFilePath, strXmlStructureFolder, EParameterCreationLibrary)) { |
| 381 | |
| 382 | return false; |
| 383 | } |
| 384 | |
| 385 | // Initialize offsets |
| 386 | pSystemClass->setOffset(0); |
| 387 | |
| 388 | // Initialize main blackboard's size |
| 389 | _pMainParameterBlackboard->setSize(pSystemClass->getFootPrint()); |
| 390 | |
| 391 | return true; |
| 392 | } |
| 393 | |
| 394 | bool CParameterMgr::loadSettings(string& strError) |
| 395 | { |
| 396 | CAutoLog autoLog(this, "Loading settings"); |
| 397 | |
| 398 | // Get settings configuration element |
| 399 | const CFrameworkConfigurationGroup* pParameterConfigurationGroup = static_cast<const CFrameworkConfigurationGroup*>(_pSystemClassConfiguration->findChildOfKind("SettingsConfiguration")); |
| 400 | |
| 401 | if (!pParameterConfigurationGroup) { |
| 402 | |
| 403 | // No settings to load |
| 404 | |
| 405 | return true; |
| 406 | } |
| 407 | // Get binary settings file location |
| 408 | const CFrameworkConfigurationLocation* pBinarySettingsFileLocation = static_cast<const CFrameworkConfigurationLocation*>(pParameterConfigurationGroup->findChildOfKind("BinarySettingsFileLocation")); |
| 409 | |
| 410 | string strXmlBinarySettingsFilePath; |
| 411 | |
| 412 | if (pBinarySettingsFileLocation) { |
| 413 | |
| 414 | // Get Xml binary settings file name |
| 415 | strXmlBinarySettingsFilePath = pBinarySettingsFileLocation->getFilePath(_strParameterFrameworkConfigurationFolderPath); |
| 416 | } |
| 417 | |
| 418 | // Get configurable domains element |
| 419 | const CFrameworkConfigurationLocation* pConfigurableDomainsFileLocation = static_cast<const CFrameworkConfigurationLocation*>(pParameterConfigurationGroup->findChildOfKind("ConfigurableDomainsFileLocation")); |
| 420 | |
| 421 | if (!pConfigurableDomainsFileLocation) { |
| 422 | |
| 423 | strError = "No ConfigurableDomainsFileLocation element found for SystemClass " + getSystemClass()->getName(); |
| 424 | |
| 425 | return false; |
| 426 | } |
| 427 | // Get destination root element |
| 428 | CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); |
| 429 | |
| 430 | // Get Xml configuration domains file name |
| 431 | string strXmlConfigurationDomainsFilePath = pConfigurableDomainsFileLocation->getFilePath(_strParameterFrameworkConfigurationFolderPath); |
| 432 | |
| 433 | // Get Xml configuration domains folder |
| 434 | string strXmlConfigurationDomainsFolder = pConfigurableDomainsFileLocation->getFolderPath(_strParameterFrameworkConfigurationFolderPath); |
| 435 | |
| 436 | // Parse configuration domains XML file (ask to read settings from XML file if they are not provided as binary) |
| 437 | CXmlDomainSerializingContext xmlDomainSerializingContext(strError, !pBinarySettingsFileLocation); |
| 438 | |
| 439 | // Selection criteria definition for rule creation |
| 440 | xmlDomainSerializingContext.setSelectionCriteriaDefinition(getConstSelectionCriteria()->getSelectionCriteriaDefinition()); |
| 441 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 442 | log("Importing configurable domains from file %s %s settings", strXmlConfigurationDomainsFilePath.c_str(), pBinarySettingsFileLocation ? "without" : "with"); |
| 443 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 444 | // Do parse |
| 445 | if (!xmlParse(xmlDomainSerializingContext, pConfigurableDomains, strXmlConfigurationDomainsFilePath, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) { |
| 446 | |
| 447 | return false; |
| 448 | } |
| 449 | // We have loaded the whole system structure, compute checksum |
| 450 | const CSystemClass* pSystemClass = getConstSystemClass(); |
| 451 | _uiStructureChecksum = pSystemClass->computeStructureChecksum() + getConfigurableDomains()->computeStructureChecksum() + getSelectionCriteria()->computeStructureChecksum(); |
| 452 | |
| 453 | // Load binary settings if any provided |
| 454 | if (pBinarySettingsFileLocation && !pConfigurableDomains->serializeSettings(strXmlBinarySettingsFilePath, false, _uiStructureChecksum, strError)) { |
| 455 | |
| 456 | return false; |
| 457 | } |
| 458 | |
| 459 | // Back synchronization for areas in parameter blackboard no covered by any domain |
| 460 | CBackSynchronizer* pBackSynchronizer = createBackSynchronizer(strError); |
| 461 | |
| 462 | log("Main blackboard back synchronization"); |
| 463 | |
| 464 | // Back-synchronize |
| 465 | if (!pBackSynchronizer->sync()) { |
| 466 | // Get rif of back synchronizer |
| 467 | delete pBackSynchronizer; |
| 468 | |
| 469 | strError = "Main blackboard back synchronization failed: " + strError; |
| 470 | |
| 471 | return false; |
| 472 | } |
| 473 | // Get rif of back synchronizer |
| 474 | delete pBackSynchronizer; |
| 475 | |
| 476 | // We're done loading the settings |
| 477 | // We need to ensure all domains are valid |
| 478 | pConfigurableDomains->validate(_pMainParameterBlackboard); |
| 479 | |
| 480 | // Ensure application of currently selected configurations |
| 481 | // Force-apply configuration(s) |
| 482 | return pConfigurableDomains->apply(_pMainParameterBlackboard, true, strError); |
| 483 | } |
| 484 | |
| 485 | // XML parsing |
| 486 | bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const string& strXmlFilePath, const string& strXmlFolder, CParameterMgr::ElementLibrary eElementLibrary, const string& strNameAttrituteName) |
| 487 | { |
| 488 | // Init serializing context |
| 489 | elementSerializingContext.set(_pElementLibrarySet->getElementLibrary(eElementLibrary), strXmlFolder, _strSchemaFolderLocation); |
| 490 | |
| 491 | // Get Schema file associated to root element |
| 492 | string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + pRootElement->getKind() + ".xsd"; |
| 493 | |
| 494 | // Parse Structure XML file |
| 495 | CXmlParser parser(strXmlFilePath, strXmlSchemaFilePath, pRootElement->getKind(), elementSerializingContext); |
| 496 | |
| 497 | if (!parser.open()) { |
| 498 | |
| 499 | return false; |
| 500 | } |
| 501 | |
| 502 | // Check Root element name attribute (if any) |
| 503 | string strRootElementName = parser.getRootElementAttributeString(strNameAttrituteName); |
| 504 | |
| 505 | if (!strRootElementName.empty() && strRootElementName != pRootElement->getName()) { |
| 506 | |
| 507 | elementSerializingContext.setError("Error: Wrong XML structure file " + strXmlFilePath); |
| 508 | elementSerializingContext.appendLineToError(pRootElement->getKind() + " element " + pRootElement->getName() + " mismatches expected " + pRootElement->getKind() + " type " + pRootElement->getName()); |
| 509 | |
| 510 | return false; |
| 511 | } |
| 512 | |
| 513 | // Start clean |
| 514 | pRootElement->clean(); |
| 515 | |
| 516 | // Parse |
| 517 | if (!parser.parse(pRootElement)) { |
| 518 | |
| 519 | // Cleanup |
| 520 | pRootElement->clean(); |
| 521 | |
| 522 | return false; |
| 523 | } |
| 524 | |
| 525 | // Close parser |
| 526 | if (!parser.close()) { |
| 527 | |
| 528 | return false; |
| 529 | } |
| 530 | |
| 531 | return true; |
| 532 | } |
| 533 | |
| 534 | // Init |
| 535 | bool CParameterMgr::init(string& strError) |
| 536 | { |
| 537 | return base::init(strError); |
| 538 | } |
| 539 | |
| 540 | // Selection criteria interface |
| 541 | CSelectionCriterionType* CParameterMgr::createSelectionCriterionType(bool bIsInclusive) |
| 542 | { |
| 543 | // Propagate |
| 544 | return getSelectionCriteria()->createSelectionCriterionType(bIsInclusive); |
| 545 | } |
| 546 | |
| 547 | CSelectionCriterion* CParameterMgr::createSelectionCriterion(const string& strName, const CSelectionCriterionType* pSelectionCriterionType) |
| 548 | { |
| 549 | // Propagate |
| 550 | return getSelectionCriteria()->createSelectionCriterion(strName, pSelectionCriterionType); |
| 551 | } |
| 552 | |
| 553 | // Selection criteria changed event |
| 554 | void CParameterMgr::selectionCriterionChanged(const CSelectionCriterion* pSelectionCriterion) |
| 555 | { |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 556 | CAutoLog autoLog(this, "Selection criterion changed event: " + pSelectionCriterion->getFormattedDescription(false)); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 557 | |
| 558 | // Lock state |
| 559 | pthread_mutex_lock(&_tuningModeMutex); |
| 560 | |
| 561 | if (!_bTuningModeIsOn) { |
| 562 | |
| 563 | // Apply configuration(s) |
| 564 | string strError; |
| 565 | |
| 566 | if (!getConfigurableDomains()->apply(_pMainParameterBlackboard, false, strError)) { |
| 567 | |
| 568 | log("Failed to apply configurations!"); |
| 569 | } |
| 570 | } |
| 571 | // Unlock state |
| 572 | pthread_mutex_unlock(&_tuningModeMutex); |
| 573 | } |
| 574 | |
| 575 | // Command processing |
| 576 | bool CParameterMgr::remoteCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 577 | { |
| 578 | log("Processing remote command: \"%s\"", remoteCommand.getCommand().c_str()); |
| 579 | |
| 580 | // Dispatch |
| 581 | uint32_t uiRemoteCommandParserItem; |
| 582 | |
| 583 | for (uiRemoteCommandParserItem = 0; uiRemoteCommandParserItem < guiNbRemoteCommandParserItems; uiRemoteCommandParserItem++) { |
| 584 | |
| 585 | const SRemoteCommandParserItem* pRemoteCommandParserItem = &gaRemoteCommandParserItems[uiRemoteCommandParserItem]; |
| 586 | |
| 587 | if (string(pRemoteCommandParserItem->_pcCommandName) == remoteCommand.getCommand()) { |
| 588 | |
| 589 | // Check enough arguments supplied |
| 590 | if (remoteCommand.getArgumentCount() < pRemoteCommandParserItem->_uiMinArgumentCount) { |
| 591 | |
| 592 | strResult = string("Not enough arguments supplied\nUsage:\n") + pRemoteCommandParserItem->usage(); |
| 593 | |
| 594 | return false; |
| 595 | } |
| 596 | |
| 597 | switch ((this->*pRemoteCommandParserItem->_pfnParser)(remoteCommand, strResult)) { |
| 598 | case EDone: |
| 599 | strResult = "Done"; |
| 600 | case ESucceeded: |
| 601 | return true; |
| 602 | case EShowUsgae: |
| 603 | strResult = pRemoteCommandParserItem->usage(); |
| 604 | // Fall through intentionally |
| 605 | case EFailed: |
| 606 | return false; |
| 607 | default: |
| 608 | assert(0); |
| 609 | } |
| 610 | } |
| 611 | } |
| 612 | // Not found |
| 613 | strResult = "Command not found!"; |
| 614 | |
| 615 | return false; |
| 616 | } |
| 617 | |
| 618 | // Max command usage length, use for formatting |
| 619 | void CParameterMgr::setMaxCommandUsageLength() |
| 620 | { |
| 621 | // Show usages |
| 622 | uint32_t uiRemoteCommandParserItem; |
| 623 | |
| 624 | for (uiRemoteCommandParserItem = 0; uiRemoteCommandParserItem < guiNbRemoteCommandParserItems; uiRemoteCommandParserItem++) { |
| 625 | |
| 626 | const SRemoteCommandParserItem* pRemoteCommandParserItem = &gaRemoteCommandParserItems[uiRemoteCommandParserItem]; |
| 627 | |
| 628 | uint32_t uiRemoteCommandUsageLength = pRemoteCommandParserItem->usage().length(); |
| 629 | |
| 630 | if (uiRemoteCommandUsageLength > _uiMaxCommandUsageLength) { |
| 631 | |
| 632 | _uiMaxCommandUsageLength = uiRemoteCommandUsageLength; |
| 633 | } |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | /////////////////// Remote command parsers |
| 638 | /// Help |
| 639 | CParameterMgr::CommandStatus CParameterMgr::helpCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 640 | { |
| 641 | (void)remoteCommand; |
| 642 | |
| 643 | strResult = "\n"; |
| 644 | |
| 645 | // Show usages |
| 646 | uint32_t uiRemoteCommandParserItem; |
| 647 | |
| 648 | for (uiRemoteCommandParserItem = 0; uiRemoteCommandParserItem < guiNbRemoteCommandParserItems; uiRemoteCommandParserItem++) { |
| 649 | |
| 650 | const SRemoteCommandParserItem* pRemoteCommandParserItem = &gaRemoteCommandParserItems[uiRemoteCommandParserItem]; |
| 651 | |
| 652 | string strUsage = pRemoteCommandParserItem->usage(); |
| 653 | |
| 654 | strResult += strUsage; |
| 655 | |
| 656 | // Align |
| 657 | uint32_t uiToSpacesAdd = _uiMaxCommandUsageLength + 5 - strUsage.length(); |
| 658 | |
| 659 | while (uiToSpacesAdd--) { |
| 660 | |
| 661 | strResult += " "; |
| 662 | } |
| 663 | |
| 664 | strResult += string("=> ") + string(pRemoteCommandParserItem->_pcDescription) + "\n"; |
| 665 | |
| 666 | } |
| 667 | return ESucceeded; |
| 668 | } |
| 669 | |
| 670 | /// Status |
| 671 | CParameterMgr::CommandStatus CParameterMgr::statusCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 672 | { |
| 673 | (void)remoteCommand; |
| 674 | // System class |
| 675 | const CSystemClass* pSystemClass = getSystemClass(); |
| 676 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 677 | // Show status |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 678 | /// General section |
| 679 | appendTitle(strResult, "General:"); |
| 680 | // System class |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 681 | strResult += "System Class: "; |
| 682 | strResult += pSystemClass->getName(); |
| 683 | strResult += "\n"; |
| 684 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 685 | // Tuning mode |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 686 | strResult += "Tuning Mode: "; |
| 687 | strResult += tuningModeOn() ? "on" : "off"; |
| 688 | strResult += "\n"; |
| 689 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 690 | // Value space |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 691 | strResult += "Value Space: "; |
| 692 | strResult += valueSpaceIsRaw() ? "raw" : "real"; |
| 693 | strResult += "\n"; |
| 694 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 695 | // Output raw format |
| 696 | strResult += "Output Raw Format: "; |
| 697 | strResult += outputRawFormatIsHex() ? "hex" : "dec"; |
| 698 | strResult += "\n"; |
| 699 | |
| 700 | // Auto Sync |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 701 | strResult += "Auto Sync: "; |
| 702 | strResult += autoSyncOn() ? "on" : "off"; |
| 703 | strResult += "\n"; |
| 704 | |
| 705 | /// Subsystem list |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 706 | appendTitle(strResult, "Subsystems:"); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 707 | string strSubsystemList; |
| 708 | pSystemClass->listChildrenPaths(strSubsystemList); |
| 709 | strResult += strSubsystemList; |
| 710 | |
| 711 | /// Last applied configurations |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 712 | appendTitle(strResult, "Last applied configurations:"); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 713 | string strLastAppliedConfigurations; |
| 714 | getConfigurableDomains()->listLastAppliedConfigurations(strLastAppliedConfigurations); |
| 715 | strResult += strLastAppliedConfigurations; |
| 716 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 717 | /// Criteria states |
| 718 | appendTitle(strResult, "Selection criteria:"); |
| 719 | string strSelectionCriteria; |
| 720 | getSelectionCriteria()->listSelectionCriteria(strSelectionCriteria, false); |
| 721 | strResult += strSelectionCriteria; |
| 722 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 723 | return ESucceeded; |
| 724 | } |
| 725 | |
| 726 | /// Tuning Mode |
| 727 | CParameterMgr::CommandStatus CParameterMgr::setTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 728 | { |
| 729 | if (remoteCommand.getArgument(0) == "on") { |
| 730 | |
| 731 | if (setTuningMode(true, strResult)) { |
| 732 | |
| 733 | return EDone; |
| 734 | } |
| 735 | } else if (remoteCommand.getArgument(0) == "off") { |
| 736 | |
| 737 | if (setTuningMode(false, strResult)) { |
| 738 | |
| 739 | return EDone; |
| 740 | } |
| 741 | } else { |
| 742 | // Show usage |
| 743 | return EShowUsgae; |
| 744 | } |
| 745 | return EFailed; |
| 746 | } |
| 747 | |
| 748 | CParameterMgr::CommandStatus CParameterMgr::getTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 749 | { |
| 750 | (void)remoteCommand; |
| 751 | |
| 752 | strResult = tuningModeOn() ? "on" : "off"; |
| 753 | |
| 754 | return ESucceeded; |
| 755 | } |
| 756 | |
| 757 | /// Value Space |
| 758 | CParameterMgr::CommandStatus CParameterMgr::setValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 759 | { |
| 760 | (void)strResult; |
| 761 | |
| 762 | if (remoteCommand.getArgument(0) == "raw") { |
| 763 | |
| 764 | setValueSpace(true); |
| 765 | |
| 766 | return EDone; |
| 767 | |
| 768 | } else if (remoteCommand.getArgument(0) == "real") { |
| 769 | |
| 770 | setValueSpace(false); |
| 771 | |
| 772 | return EDone; |
| 773 | |
| 774 | } else { |
| 775 | // Show usage |
| 776 | return EShowUsgae; |
| 777 | } |
| 778 | return EFailed; |
| 779 | } |
| 780 | |
| 781 | CParameterMgr::CommandStatus CParameterMgr::getValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 782 | { |
| 783 | (void)remoteCommand; |
| 784 | |
| 785 | strResult = valueSpaceIsRaw() ? "raw" : "real"; |
| 786 | |
| 787 | return ESucceeded; |
| 788 | } |
| 789 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 790 | /// Output Raw Format |
| 791 | CParameterMgr::CommandStatus CParameterMgr::setOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 792 | { |
| 793 | (void)strResult; |
| 794 | |
| 795 | if (remoteCommand.getArgument(0) == "hex") { |
| 796 | |
| 797 | setOutputRawFormat(true); |
| 798 | |
| 799 | return EDone; |
| 800 | |
| 801 | } else if (remoteCommand.getArgument(0) == "dec") { |
| 802 | |
| 803 | setOutputRawFormat(false); |
| 804 | |
| 805 | return EDone; |
| 806 | |
| 807 | } else { |
| 808 | // Show usage |
| 809 | return EShowUsgae; |
| 810 | } |
| 811 | return EFailed; |
| 812 | } |
| 813 | |
| 814 | CParameterMgr::CommandStatus CParameterMgr::getOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 815 | { |
| 816 | (void)remoteCommand; |
| 817 | |
| 818 | strResult = outputRawFormatIsHex() ? "hex" : "dec"; |
| 819 | |
| 820 | return ESucceeded; |
| 821 | } |
| 822 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 823 | /// Sync |
| 824 | CParameterMgr::CommandStatus CParameterMgr::setAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 825 | { |
| 826 | if (remoteCommand.getArgument(0) == "on") { |
| 827 | |
| 828 | if (setAutoSync(true, strResult)) { |
| 829 | |
| 830 | return EDone; |
| 831 | } |
| 832 | } else if (remoteCommand.getArgument(0) == "off") { |
| 833 | |
| 834 | if (setAutoSync(false, strResult)) { |
| 835 | |
| 836 | return EDone; |
| 837 | } |
| 838 | } else { |
| 839 | // Show usage |
| 840 | return EShowUsgae; |
| 841 | } |
| 842 | return EFailed; |
| 843 | } |
| 844 | |
| 845 | CParameterMgr::CommandStatus CParameterMgr::getAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 846 | { |
| 847 | (void)remoteCommand; |
| 848 | |
| 849 | strResult = autoSyncOn() ? "on" : "off"; |
| 850 | |
| 851 | return ESucceeded; |
| 852 | } |
| 853 | |
| 854 | CParameterMgr::CommandStatus CParameterMgr::syncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 855 | { |
| 856 | (void)remoteCommand; |
| 857 | |
| 858 | return sync(strResult) ? EDone : EFailed; |
| 859 | } |
| 860 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 861 | /// Criteria |
| 862 | CParameterMgr::CommandStatus CParameterMgr::listCriteriaCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 863 | { |
| 864 | (void)remoteCommand; |
| 865 | |
| 866 | getSelectionCriteria()->listSelectionCriteria(strResult, true); |
| 867 | |
| 868 | return ESucceeded; |
| 869 | } |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 870 | |
| 871 | /// Domains |
| 872 | CParameterMgr::CommandStatus CParameterMgr::listDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 873 | { |
| 874 | (void)remoteCommand; |
| 875 | |
| 876 | getConfigurableDomains()->listChildren(strResult); |
| 877 | |
| 878 | return ESucceeded; |
| 879 | } |
| 880 | |
| 881 | CParameterMgr::CommandStatus CParameterMgr::createDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 882 | { |
| 883 | return createDomain(remoteCommand.getArgument(0), strResult) ? EDone : EFailed; |
| 884 | } |
| 885 | |
| 886 | CParameterMgr::CommandStatus CParameterMgr::deleteDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 887 | { |
| 888 | return deleteDomain(remoteCommand.getArgument(0), strResult) ? EDone : EFailed; |
| 889 | } |
| 890 | |
| 891 | CParameterMgr::CommandStatus CParameterMgr::renameDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 892 | { |
| 893 | return getConfigurableDomains()->renameDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? EDone : EFailed; |
| 894 | } |
| 895 | |
| 896 | CParameterMgr::CommandStatus CParameterMgr::listDomainElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 897 | { |
| 898 | return getConfigurableDomains()->listDomainElements(remoteCommand.getArgument(0), strResult) ? ESucceeded : EFailed; |
| 899 | } |
| 900 | |
| 901 | CParameterMgr::CommandStatus CParameterMgr::addElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 902 | { |
| 903 | return addConfigurableElementToDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? EDone : EFailed; |
| 904 | } |
| 905 | |
| 906 | CParameterMgr::CommandStatus CParameterMgr::removeElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 907 | { |
| 908 | return removeConfigurableElementFromDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? EDone : EFailed; |
| 909 | } |
| 910 | |
| 911 | CParameterMgr::CommandStatus CParameterMgr::splitDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 912 | { |
| 913 | return split(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? EDone : EFailed; |
| 914 | } |
| 915 | |
| 916 | /// Configurations |
| 917 | CParameterMgr::CommandStatus CParameterMgr::listConfigurationsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 918 | { |
| 919 | return getConfigurableDomains()->listConfigurations(remoteCommand.getArgument(0), strResult) ? ESucceeded : EFailed; |
| 920 | } |
| 921 | |
| 922 | CParameterMgr::CommandStatus CParameterMgr::createConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 923 | { |
| 924 | return createConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? EDone : EFailed; |
| 925 | } |
| 926 | |
| 927 | CParameterMgr::CommandStatus CParameterMgr::deleteConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 928 | { |
| 929 | return deleteConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? EDone : EFailed; |
| 930 | } |
| 931 | |
| 932 | CParameterMgr::CommandStatus CParameterMgr::renameConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 933 | { |
| 934 | return getConfigurableDomains()->renameConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), remoteCommand.getArgument(2), strResult) ? EDone : EFailed; |
| 935 | } |
| 936 | |
| 937 | CParameterMgr::CommandStatus CParameterMgr::saveConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 938 | { |
| 939 | return saveConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? EDone : EFailed; |
| 940 | } |
| 941 | |
| 942 | CParameterMgr::CommandStatus CParameterMgr::restoreConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 943 | { |
| 944 | return restoreConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? EDone : EFailed; |
| 945 | } |
| 946 | |
| 947 | /// Elements/Parameters |
| 948 | CParameterMgr::CommandStatus CParameterMgr::listElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 949 | { |
| 950 | CElementLocator elementLocator(getSystemClass(), false); |
| 951 | |
| 952 | CElement* pLocatedElement = NULL; |
| 953 | |
| 954 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 955 | |
| 956 | return EFailed; |
| 957 | } |
| 958 | |
| 959 | strResult = string("\n"); |
| 960 | |
| 961 | if (!pLocatedElement) { |
| 962 | |
| 963 | // List from root folder |
| 964 | |
| 965 | // Return system class qualified name |
| 966 | pLocatedElement = getSystemClass(); |
| 967 | } |
| 968 | |
| 969 | // Return sub-elements |
| 970 | strResult += pLocatedElement->listQualifiedPaths(false); |
| 971 | |
| 972 | return ESucceeded; |
| 973 | } |
| 974 | |
| 975 | /// Elements/Parameters |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 976 | CParameterMgr::CommandStatus CParameterMgr::listParametersCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 977 | { |
| 978 | CElementLocator elementLocator(getSystemClass(), false); |
| 979 | |
| 980 | CElement* pLocatedElement = NULL; |
| 981 | |
| 982 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 983 | |
| 984 | return EFailed; |
| 985 | } |
| 986 | |
| 987 | strResult = string("\n"); |
| 988 | |
| 989 | if (!pLocatedElement) { |
| 990 | |
| 991 | // List from root folder |
| 992 | |
| 993 | // Return system class qualified name |
| 994 | pLocatedElement = getSystemClass(); |
| 995 | } |
| 996 | |
| 997 | // Return sub-elements |
| 998 | strResult += pLocatedElement->listQualifiedPaths(true); |
| 999 | |
| 1000 | return ESucceeded; |
| 1001 | } |
| 1002 | |
| 1003 | CParameterMgr::CommandStatus CParameterMgr::dumpElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1004 | { |
| 1005 | CElementLocator elementLocator(getSystemClass()); |
| 1006 | |
| 1007 | CElement* pLocatedElement = NULL; |
| 1008 | |
| 1009 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1010 | |
| 1011 | return EFailed; |
| 1012 | } |
| 1013 | |
| 1014 | string strError; |
| 1015 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1016 | CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1017 | |
| 1018 | // Dump elements |
| 1019 | pLocatedElement->dumpContent(strResult, parameterAccessContext); |
| 1020 | |
| 1021 | return ESucceeded; |
| 1022 | } |
| 1023 | |
| 1024 | CParameterMgr::CommandStatus CParameterMgr::getElementSizeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1025 | { |
| 1026 | CElementLocator elementLocator(getSystemClass()); |
| 1027 | |
| 1028 | CElement* pLocatedElement = NULL; |
| 1029 | |
| 1030 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1031 | |
| 1032 | return EFailed; |
| 1033 | } |
| 1034 | |
| 1035 | // Converted to actual sizable element |
| 1036 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1037 | |
| 1038 | // Get size as string |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1039 | strResult = pConfigurableElement->getFootprintAsString(); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1040 | |
| 1041 | return ESucceeded; |
| 1042 | } |
| 1043 | |
Patrick Benavoli | 2ecf900 | 2011-08-31 11:23:24 +0200 | [diff] [blame^] | 1044 | CParameterMgr::CommandStatus CParameterMgr::showPropertiesCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1045 | { |
| 1046 | CElementLocator elementLocator(getSystemClass()); |
| 1047 | |
| 1048 | CElement* pLocatedElement = NULL; |
| 1049 | |
| 1050 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1051 | |
| 1052 | return EFailed; |
| 1053 | } |
| 1054 | |
| 1055 | // Convert element |
| 1056 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1057 | |
| 1058 | // Return element properties |
| 1059 | pConfigurableElement->showProperties(strResult); |
| 1060 | |
| 1061 | return ESucceeded; |
| 1062 | } |
| 1063 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1064 | CParameterMgr::CommandStatus CParameterMgr::getParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1065 | { |
| 1066 | string strValue; |
| 1067 | |
| 1068 | if (!getValue(remoteCommand.getArgument(0), strValue, strResult)) { |
| 1069 | |
| 1070 | return EFailed; |
| 1071 | } |
| 1072 | // Succeeded |
| 1073 | strResult = strValue; |
| 1074 | |
| 1075 | return ESucceeded; |
| 1076 | } |
| 1077 | |
| 1078 | CParameterMgr::CommandStatus CParameterMgr::setParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1079 | { |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1080 | return setValue(remoteCommand.getArgument(0), remoteCommand.packArguments(1, remoteCommand.getArgumentCount() - 1), strResult) ? EDone : EFailed; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1081 | } |
| 1082 | |
| 1083 | CParameterMgr::CommandStatus CParameterMgr::listBelongingDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1084 | { |
| 1085 | CElementLocator elementLocator(getSystemClass()); |
| 1086 | |
| 1087 | CElement* pLocatedElement = NULL; |
| 1088 | |
| 1089 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1090 | |
| 1091 | return EFailed; |
| 1092 | } |
| 1093 | |
| 1094 | // Convert element |
| 1095 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1096 | |
| 1097 | // Return element belonging domains |
| 1098 | pConfigurableElement->listBelongingDomains(strResult); |
| 1099 | |
| 1100 | return ESucceeded; |
| 1101 | } |
| 1102 | |
| 1103 | CParameterMgr::CommandStatus CParameterMgr::listAssociatedDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1104 | { |
| 1105 | CElementLocator elementLocator(getSystemClass()); |
| 1106 | |
| 1107 | CElement* pLocatedElement = NULL; |
| 1108 | |
| 1109 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1110 | |
| 1111 | return EFailed; |
| 1112 | } |
| 1113 | |
| 1114 | // Convert element |
| 1115 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1116 | |
| 1117 | // Return element belonging domains |
| 1118 | pConfigurableElement->listAssociatedDomains(strResult); |
| 1119 | |
| 1120 | return ESucceeded; |
| 1121 | } |
| 1122 | |
| 1123 | CParameterMgr::CommandStatus CParameterMgr::listAssociatedElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1124 | { |
| 1125 | (void)remoteCommand; |
| 1126 | |
| 1127 | getConfigurableDomains()->listAssociatedElements(strResult); |
| 1128 | |
| 1129 | return ESucceeded; |
| 1130 | } |
| 1131 | |
| 1132 | CParameterMgr::CommandStatus CParameterMgr::listConflictingElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1133 | { |
| 1134 | (void)remoteCommand; |
| 1135 | |
| 1136 | getConfigurableDomains()->listConflictingElements(strResult); |
| 1137 | |
| 1138 | return ESucceeded; |
| 1139 | } |
| 1140 | |
| 1141 | CParameterMgr::CommandStatus CParameterMgr::listRogueElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1142 | { |
| 1143 | (void)remoteCommand; |
| 1144 | |
| 1145 | getSystemClass()->listRogueElements(strResult); |
| 1146 | |
| 1147 | return ESucceeded; |
| 1148 | } |
| 1149 | |
| 1150 | /// Settings Import/Export |
| 1151 | CParameterMgr::CommandStatus CParameterMgr::exportConfigurableDomainsToXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1152 | { |
| 1153 | return exportDomainsXml(remoteCommand.getArgument(0), false, strResult) ? EDone : EFailed; |
| 1154 | } |
| 1155 | |
| 1156 | CParameterMgr::CommandStatus CParameterMgr::importConfigurableDomainsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1157 | { |
| 1158 | return importDomainsXml(remoteCommand.getArgument(0), false, strResult) ? EDone : EFailed; |
| 1159 | } |
| 1160 | |
| 1161 | CParameterMgr::CommandStatus CParameterMgr::exportConfigurableDomainsWithSettingsToXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1162 | { |
| 1163 | return exportDomainsXml(remoteCommand.getArgument(0), true, strResult) ? EDone : EFailed; |
| 1164 | } |
| 1165 | |
| 1166 | CParameterMgr::CommandStatus CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1167 | { |
| 1168 | return importDomainsXml(remoteCommand.getArgument(0), true, strResult) ? EDone : EFailed; |
| 1169 | } |
| 1170 | |
| 1171 | CParameterMgr::CommandStatus CParameterMgr::exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1172 | { |
| 1173 | return exportDomainsBinary(remoteCommand.getArgument(0), strResult) ? EDone : EFailed; |
| 1174 | } |
| 1175 | |
| 1176 | CParameterMgr::CommandStatus CParameterMgr::importSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1177 | { |
| 1178 | return importDomainsBinary(remoteCommand.getArgument(0), strResult) ? EDone : EFailed; |
| 1179 | } |
| 1180 | |
| 1181 | // User set/get parameters |
| 1182 | bool CParameterMgr::setValue(const string& strPath, const string& strValue, string& strError) |
| 1183 | { |
| 1184 | // Check tuning mode |
| 1185 | if (!checkTuningModeOn(strError)) { |
| 1186 | |
| 1187 | return false; |
| 1188 | } |
| 1189 | |
| 1190 | CPathNavigator pathNavigator(strPath); |
| 1191 | |
| 1192 | if (!pathNavigator.isPathValid()) { |
| 1193 | |
| 1194 | strError = "Path not well formed"; |
| 1195 | |
| 1196 | return false; |
| 1197 | } |
| 1198 | |
| 1199 | string* pStrChildName = pathNavigator.next(); |
| 1200 | |
| 1201 | if (!pStrChildName) { |
| 1202 | |
| 1203 | strError = "Non settable element"; |
| 1204 | |
| 1205 | return false; |
| 1206 | } |
| 1207 | |
| 1208 | if (*pStrChildName != getSystemClass()->getName()) { |
| 1209 | |
| 1210 | strError = "Path not found"; |
| 1211 | |
| 1212 | return false; |
| 1213 | } |
| 1214 | |
| 1215 | // Define context |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1216 | CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1217 | |
| 1218 | // Set auto sync |
| 1219 | parameterAccessContext.setAutoSync(_bAutoSyncOn); |
| 1220 | |
| 1221 | // Do the set |
| 1222 | return getSystemClass()->setValue(pathNavigator, strValue, parameterAccessContext); |
| 1223 | } |
| 1224 | |
| 1225 | bool CParameterMgr::getValue(const string& strPath, string& strValue, string& strError) const |
| 1226 | { |
| 1227 | CPathNavigator pathNavigator(strPath); |
| 1228 | |
| 1229 | if (!pathNavigator.isPathValid()) { |
| 1230 | |
| 1231 | strError = "Path not well formed"; |
| 1232 | |
| 1233 | return false; |
| 1234 | } |
| 1235 | |
| 1236 | string* pStrChildName = pathNavigator.next(); |
| 1237 | |
| 1238 | if (!pStrChildName) { |
| 1239 | |
| 1240 | strError = "Non settable element"; |
| 1241 | |
| 1242 | return false; |
| 1243 | } |
| 1244 | |
| 1245 | if (*pStrChildName != getConstSystemClass()->getName()) { |
| 1246 | |
| 1247 | strError = "Path not found"; |
| 1248 | |
| 1249 | return false; |
| 1250 | } |
| 1251 | |
| 1252 | // Define context |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1253 | CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1254 | |
| 1255 | // Do the get |
| 1256 | return getConstSystemClass()->getValue(pathNavigator, strValue, parameterAccessContext); |
| 1257 | } |
| 1258 | |
| 1259 | // Tuning mode |
| 1260 | bool CParameterMgr::setTuningMode(bool bOn, string& strError) |
| 1261 | { |
| 1262 | // Tuning allowed? |
| 1263 | if (bOn && !_pSystemClassConfiguration->isTuningAllowed()) { |
| 1264 | |
| 1265 | strError = "Tuning prohibited"; |
| 1266 | |
| 1267 | return false; |
| 1268 | } |
| 1269 | // Lock state |
| 1270 | pthread_mutex_lock(&_tuningModeMutex); |
| 1271 | |
| 1272 | // Warn domains about exiting tuning mode |
| 1273 | if (!bOn && _bTuningModeIsOn) { |
| 1274 | |
| 1275 | // Ensure application of currently selected configurations |
| 1276 | // Force-apply configuration(s) |
| 1277 | if (!getConfigurableDomains()->apply(_pMainParameterBlackboard, true, strError)) { |
| 1278 | |
| 1279 | return false; |
| 1280 | } |
| 1281 | // Turn auto sync back on |
| 1282 | _bAutoSyncOn = true; |
| 1283 | } |
| 1284 | |
| 1285 | // Store |
| 1286 | _bTuningModeIsOn = bOn; |
| 1287 | |
| 1288 | // Unlock state |
| 1289 | pthread_mutex_unlock(&_tuningModeMutex); |
| 1290 | |
| 1291 | return true; |
| 1292 | } |
| 1293 | |
| 1294 | bool CParameterMgr::tuningModeOn() const |
| 1295 | { |
| 1296 | return _bTuningModeIsOn; |
| 1297 | } |
| 1298 | |
| 1299 | // Current value space for user set/get value interpretation |
| 1300 | void CParameterMgr::setValueSpace(bool bIsRaw) |
| 1301 | { |
| 1302 | _bValueSpaceIsRaw = bIsRaw; |
| 1303 | } |
| 1304 | |
| 1305 | bool CParameterMgr::valueSpaceIsRaw() |
| 1306 | { |
| 1307 | return _bValueSpaceIsRaw; |
| 1308 | } |
| 1309 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1310 | // Current Output Raw Format for user get value interpretation |
| 1311 | void CParameterMgr::setOutputRawFormat(bool bIsHex) |
| 1312 | { |
| 1313 | _bOutputRawFormatIsHex = bIsHex; |
| 1314 | } |
| 1315 | |
| 1316 | bool CParameterMgr::outputRawFormatIsHex() |
| 1317 | { |
| 1318 | return _bOutputRawFormatIsHex; |
| 1319 | } |
| 1320 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1321 | /// Sync |
| 1322 | // Automatic hardware synchronization control (during tuning session) |
| 1323 | bool CParameterMgr::setAutoSync(bool bAutoSyncOn, string& strError) |
| 1324 | { |
| 1325 | // Check tuning mode |
| 1326 | if (!checkTuningModeOn(strError)) { |
| 1327 | |
| 1328 | return false; |
| 1329 | } |
| 1330 | // Warn domains about turning auto sync back on |
| 1331 | if (bAutoSyncOn && !_bAutoSyncOn) { |
| 1332 | |
| 1333 | // Ensure application of currently selected configurations |
| 1334 | // Force-apply configuration(s) |
| 1335 | if (!getConfigurableDomains()->apply(_pMainParameterBlackboard, true, strError)) { |
| 1336 | |
| 1337 | return false; |
| 1338 | } |
| 1339 | } |
| 1340 | |
| 1341 | // Set Auto sync |
| 1342 | _bAutoSyncOn = bAutoSyncOn; |
| 1343 | |
| 1344 | return true; |
| 1345 | } |
| 1346 | |
| 1347 | bool CParameterMgr::autoSyncOn() const |
| 1348 | { |
| 1349 | return _bAutoSyncOn; |
| 1350 | } |
| 1351 | |
| 1352 | // Manual hardware synchronization control (during tuning session) |
| 1353 | bool CParameterMgr::sync(string& strError) |
| 1354 | { |
| 1355 | // Check tuning mode |
| 1356 | if (!checkTuningModeOn(strError)) { |
| 1357 | |
| 1358 | return false; |
| 1359 | } |
| 1360 | // Warn domains about turning auto sync back on |
| 1361 | if (_bAutoSyncOn) { |
| 1362 | |
| 1363 | strError = "Feature unavailable when Auto Sync is on"; |
| 1364 | |
| 1365 | return false; |
| 1366 | } |
| 1367 | |
| 1368 | // Get syncer set |
| 1369 | CSyncerSet syncerSet; |
| 1370 | // ... from system class |
| 1371 | getConstSystemClass()->fillSyncerSet(syncerSet); |
| 1372 | // Sync |
| 1373 | return syncerSet.sync(*_pMainParameterBlackboard, false, strError); |
| 1374 | } |
| 1375 | |
| 1376 | // Content dump |
| 1377 | void CParameterMgr::logStructureContent(string& strContent) const |
| 1378 | { |
| 1379 | string strError; |
| 1380 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1381 | CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1382 | |
| 1383 | dumpContent(strContent, parameterAccessContext); |
| 1384 | } |
| 1385 | |
| 1386 | // Configuration/Domains handling |
| 1387 | bool CParameterMgr::createDomain(const string& strName, string& strError) |
| 1388 | { |
| 1389 | // Check tuning mode |
| 1390 | if (!checkTuningModeOn(strError)) { |
| 1391 | |
| 1392 | return false; |
| 1393 | } |
| 1394 | |
| 1395 | // Delegate to configurable domains |
| 1396 | return getConfigurableDomains()->createDomain(strName, strError); |
| 1397 | } |
| 1398 | |
| 1399 | bool CParameterMgr::deleteDomain(const string& strName, string& strError) |
| 1400 | { |
| 1401 | // Check tuning mode |
| 1402 | if (!checkTuningModeOn(strError)) { |
| 1403 | |
| 1404 | return false; |
| 1405 | } |
| 1406 | |
| 1407 | // Delegate to configurable domains |
| 1408 | return getConfigurableDomains()->deleteDomain(strName, strError); |
| 1409 | } |
| 1410 | |
| 1411 | bool CParameterMgr::createConfiguration(const string& strDomain, const string& strConfiguration, string& strError) |
| 1412 | { |
| 1413 | // Check tuning mode |
| 1414 | if (!checkTuningModeOn(strError)) { |
| 1415 | |
| 1416 | return false; |
| 1417 | } |
| 1418 | |
| 1419 | // Delegate to configurable domains |
| 1420 | return getConfigurableDomains()->createConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, strError); |
| 1421 | } |
| 1422 | |
| 1423 | bool CParameterMgr::deleteConfiguration(const string& strDomain, const string& strConfiguration, string& strError) |
| 1424 | { |
| 1425 | // Check tuning mode |
| 1426 | if (!checkTuningModeOn(strError)) { |
| 1427 | |
| 1428 | return false; |
| 1429 | } |
| 1430 | |
| 1431 | // Delegate to configurable domains |
| 1432 | return getConfigurableDomains()->deleteConfiguration(strDomain, strConfiguration, strError); |
| 1433 | } |
| 1434 | |
| 1435 | bool CParameterMgr::restoreConfiguration(const string& strDomain, const string& strConfiguration, string& strError) |
| 1436 | { |
| 1437 | // Check tuning mode |
| 1438 | if (!checkTuningModeOn(strError)) { |
| 1439 | |
| 1440 | return false; |
| 1441 | } |
| 1442 | |
| 1443 | // Delegate to configurable domains |
| 1444 | return getConfigurableDomains()->restoreConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, _bAutoSyncOn, strError); |
| 1445 | } |
| 1446 | |
| 1447 | bool CParameterMgr::saveConfiguration(const string& strDomain, const string& strConfiguration, string& strError) |
| 1448 | { |
| 1449 | // Check tuning mode |
| 1450 | if (!checkTuningModeOn(strError)) { |
| 1451 | |
| 1452 | return false; |
| 1453 | } |
| 1454 | |
| 1455 | // Delegate to configurable domains |
| 1456 | return getConfigurableDomains()->saveConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, strError); |
| 1457 | } |
| 1458 | |
| 1459 | // Configurable element - domain association |
| 1460 | bool CParameterMgr::addConfigurableElementToDomain(const string& strDomain, const string& strConfigurableElementPath, string& strError) |
| 1461 | { |
| 1462 | // Check tuning mode |
| 1463 | if (!checkTuningModeOn(strError)) { |
| 1464 | |
| 1465 | return false; |
| 1466 | } |
| 1467 | |
| 1468 | CElementLocator elementLocator(getSystemClass()); |
| 1469 | |
| 1470 | CElement* pLocatedElement = NULL; |
| 1471 | |
| 1472 | if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) { |
| 1473 | |
| 1474 | return false; |
| 1475 | } |
| 1476 | |
| 1477 | // Convert element |
| 1478 | CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1479 | |
| 1480 | // Delegate |
| 1481 | return getConfigurableDomains()->addConfigurableElementToDomain(strDomain, pConfigurableElement, _pMainParameterBlackboard, strError); |
| 1482 | } |
| 1483 | |
| 1484 | bool CParameterMgr::removeConfigurableElementFromDomain(const string& strDomain, const string& strConfigurableElementPath, string& strError) |
| 1485 | { |
| 1486 | // Check tuning mode |
| 1487 | if (!checkTuningModeOn(strError)) { |
| 1488 | |
| 1489 | return false; |
| 1490 | } |
| 1491 | |
| 1492 | CElementLocator elementLocator(getSystemClass()); |
| 1493 | |
| 1494 | CElement* pLocatedElement = NULL; |
| 1495 | |
| 1496 | if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) { |
| 1497 | |
| 1498 | return EFailed; |
| 1499 | } |
| 1500 | |
| 1501 | // Convert element |
| 1502 | CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1503 | |
| 1504 | // Delegate |
| 1505 | return getConfigurableDomains()->removeConfigurableElementFromDomain(strDomain, pConfigurableElement, strError); |
| 1506 | } |
| 1507 | |
| 1508 | bool CParameterMgr::split(const string& strDomain, const string& strConfigurableElementPath, string& strError) |
| 1509 | { |
| 1510 | // Check tuning mode |
| 1511 | if (!checkTuningModeOn(strError)) { |
| 1512 | |
| 1513 | return false; |
| 1514 | } |
| 1515 | |
| 1516 | CElementLocator elementLocator(getSystemClass()); |
| 1517 | |
| 1518 | CElement* pLocatedElement = NULL; |
| 1519 | |
| 1520 | if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) { |
| 1521 | |
| 1522 | return EFailed; |
| 1523 | } |
| 1524 | |
| 1525 | // Convert element |
| 1526 | CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1527 | |
| 1528 | // Delegate |
| 1529 | return getConfigurableDomains()->split(strDomain, pConfigurableElement, strError); |
| 1530 | } |
| 1531 | |
| 1532 | // XML Import/Export |
| 1533 | bool CParameterMgr::importDomainsXml(const string& strFileName, bool bWithSettings, string& strError) |
| 1534 | { |
| 1535 | // Check tuning mode |
| 1536 | if (!checkTuningModeOn(strError)) { |
| 1537 | |
| 1538 | return false; |
| 1539 | } |
| 1540 | |
| 1541 | // check path is absolute |
| 1542 | if (strFileName[0] != '/') { |
| 1543 | |
| 1544 | strError = "Please provide absolute path"; |
| 1545 | |
| 1546 | return false; |
| 1547 | } |
| 1548 | // Root element |
| 1549 | CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); |
| 1550 | |
| 1551 | // Context |
| 1552 | CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings); |
| 1553 | |
| 1554 | // Secltion criteria definition for rule creation |
| 1555 | xmlDomainSerializingContext.setSelectionCriteriaDefinition(getConstSelectionCriteria()->getSelectionCriteriaDefinition()); |
| 1556 | |
| 1557 | // Parse |
| 1558 | if (!xmlParse(xmlDomainSerializingContext, pConfigurableDomains, strFileName, "", EParameterConfigurationLibrary, "SystemClassName")) { |
| 1559 | |
| 1560 | return false; |
| 1561 | } |
| 1562 | |
| 1563 | // Validate domains after XML import |
| 1564 | pConfigurableDomains->validate(_pMainParameterBlackboard); |
| 1565 | |
| 1566 | return true; |
| 1567 | } |
| 1568 | |
| 1569 | bool CParameterMgr::exportDomainsXml(const string& strFileName, bool bWithSettings, string& strError) const |
| 1570 | { |
| 1571 | // check path is absolute |
| 1572 | if (strFileName[0] != '/') { |
| 1573 | |
| 1574 | strError = "Please provide absolute path"; |
| 1575 | |
| 1576 | return false; |
| 1577 | } |
| 1578 | |
| 1579 | // Root element |
| 1580 | const CConfigurableDomains* pConfigurableDomains = getConstConfigurableDomains(); |
| 1581 | |
| 1582 | // Get Schema file associated to root element |
| 1583 | string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + pConfigurableDomains->getKind() + ".xsd"; |
| 1584 | |
| 1585 | // Context |
| 1586 | CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings); |
| 1587 | |
| 1588 | // Value space |
| 1589 | xmlDomainSerializingContext.setValueSpaceRaw(_bValueSpaceIsRaw); |
| 1590 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1591 | // Output raw format |
| 1592 | xmlDomainSerializingContext.setOutputRawFormat(_bOutputRawFormatIsHex); |
| 1593 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1594 | // Instantiate composer |
| 1595 | CXmlComposer xmlComposer(strFileName, strXmlSchemaFilePath, pConfigurableDomains->getKind(), xmlDomainSerializingContext); |
| 1596 | |
| 1597 | // Open composer |
| 1598 | if (!xmlComposer.open()) { |
| 1599 | |
| 1600 | return false; |
| 1601 | } |
| 1602 | |
| 1603 | // Compose |
| 1604 | xmlComposer.compose(pConfigurableDomains); |
| 1605 | |
| 1606 | // Close composer |
| 1607 | if (!xmlComposer.close()) { |
| 1608 | |
| 1609 | return false; |
| 1610 | } |
| 1611 | |
| 1612 | return true; |
| 1613 | } |
| 1614 | |
| 1615 | // Binary Import/Export |
| 1616 | bool CParameterMgr::importDomainsBinary(const string& strFileName, string& strError) |
| 1617 | { |
| 1618 | // Check tuning mode |
| 1619 | if (!checkTuningModeOn(strError)) { |
| 1620 | |
| 1621 | return false; |
| 1622 | } |
| 1623 | // check path is absolute |
| 1624 | if (strFileName[0] != '/') { |
| 1625 | |
| 1626 | strError = "Please provide absolute path"; |
| 1627 | |
| 1628 | return false; |
| 1629 | } |
| 1630 | // Root element |
| 1631 | CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); |
| 1632 | |
| 1633 | // Serialize in |
| 1634 | return pConfigurableDomains->serializeSettings(strFileName, false, _uiStructureChecksum, strError); |
| 1635 | } |
| 1636 | |
| 1637 | bool CParameterMgr::exportDomainsBinary(const string& strFileName, string& strError) |
| 1638 | { |
| 1639 | // check path is absolute |
| 1640 | if (strFileName[0] != '/') { |
| 1641 | |
| 1642 | strError = "Please provide absolute path"; |
| 1643 | |
| 1644 | return false; |
| 1645 | } |
| 1646 | // Check tuning mode |
| 1647 | if (!checkTuningModeOn(strError)) { |
| 1648 | |
| 1649 | return false; |
| 1650 | } |
| 1651 | // Root element |
| 1652 | CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); |
| 1653 | |
| 1654 | // Serialize out |
| 1655 | return pConfigurableDomains->serializeSettings(strFileName, true, _uiStructureChecksum, strError); |
| 1656 | } |
| 1657 | |
| 1658 | // For tuning, check we're in tuning mode |
| 1659 | bool CParameterMgr::checkTuningModeOn(string& strError) const |
| 1660 | { |
| 1661 | // Tuning Mode on? |
| 1662 | if (!_bTuningModeIsOn) { |
| 1663 | |
| 1664 | strError = "Tuning Mode must be on"; |
| 1665 | |
| 1666 | return false; |
| 1667 | } |
| 1668 | return true; |
| 1669 | } |
| 1670 | |
| 1671 | // Dynamic creation library feeding |
| 1672 | void CParameterMgr::feedElementLibraries() |
| 1673 | { |
| 1674 | // Global Configuration handling |
| 1675 | CElementLibrary* pFrameworkConfigurationLibrary = new CElementLibrary; |
| 1676 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1677 | pFrameworkConfigurationLibrary->addElementBuilder(new TElementBuilderTemplate<CParameterFrameworkConfiguration>("ParameterFrameworkConfiguration")); |
| 1678 | pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationGroup>("SubsystemPluginFolders")); |
| 1679 | pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("PluginFolderLocation")); |
| 1680 | pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationGroup>("ParameterConfiguration")); |
| 1681 | pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CSystemClassConfiguration>("SystemClassConfiguration")); |
| 1682 | pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("StructureDescriptionFileLocation")); |
| 1683 | pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationGroup>("SettingsConfiguration")); |
| 1684 | pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("ConfigurableDomainsFileLocation")); |
| 1685 | pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("BinarySettingsFileLocation")); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1686 | |
| 1687 | _pElementLibrarySet->addElementLibrary(pFrameworkConfigurationLibrary); |
| 1688 | |
| 1689 | // Parameter creation |
| 1690 | CElementLibrary* pParameterCreationLibrary = new CElementLibrary; |
| 1691 | |
| 1692 | pParameterCreationLibrary->addElementBuilder(new CSubsystemElementBuilder(getSystemClass()->getSubsystemLibrary())); |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1693 | pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CComponentType>("ComponentType")); |
| 1694 | pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CComponentInstance>("Component")); |
| 1695 | pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CBitParameterType>("BitParameter")); |
| 1696 | pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CBitParameterBlockType>("BitParameterBlock")); |
| 1697 | pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CParameterBlockType>("ParameterBlock")); |
| 1698 | pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CBooleanParameterType>("BooleanParameter")); |
| 1699 | pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CIntegerParameterType>("IntegerParameter")); |
| 1700 | pParameterCreationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CFixedPointParameterType>("FixedPointParameter")); |
| 1701 | pParameterCreationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CXmlFileIncluderElement>("SubsystemInclude")); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1702 | |
| 1703 | _pElementLibrarySet->addElementLibrary(pParameterCreationLibrary); |
| 1704 | |
| 1705 | // Parameter Configuration Domains creation |
| 1706 | CElementLibrary* pParameterConfigurationLibrary = new CElementLibrary; |
| 1707 | |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1708 | pParameterConfigurationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CConfigurableDomain>("ConfigurableDomain")); |
| 1709 | pParameterConfigurationLibrary->addElementBuilder(new TNamedElementBuilderTemplate<CDomainConfiguration>("Configuration")); |
| 1710 | pParameterConfigurationLibrary->addElementBuilder(new TElementBuilderTemplate<CCompoundRule>("CompoundRule")); |
| 1711 | pParameterConfigurationLibrary->addElementBuilder(new TElementBuilderTemplate<CSelectionCriterionRule>("SelectionCriterionRule")); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1712 | |
| 1713 | _pElementLibrarySet->addElementLibrary(pParameterConfigurationLibrary); |
| 1714 | } |
| 1715 | |
| 1716 | // Remote Processor Server connection handling |
| 1717 | bool CParameterMgr::handleRemoteProcessingInterface(string& strError) |
| 1718 | { |
| 1719 | CAutoLog autoLog(this, "Handling remote processing interface"); |
| 1720 | |
| 1721 | // Start server if tuning allowed |
| 1722 | if (_pSystemClassConfiguration->isTuningAllowed()) { |
| 1723 | |
| 1724 | log("Loading remote processor library"); |
| 1725 | |
| 1726 | // Load library |
| 1727 | void* lib_handle = dlopen("libremote-processor.so", RTLD_NOW); |
| 1728 | |
| 1729 | if (!lib_handle) { |
| 1730 | |
| 1731 | // Return error |
| 1732 | const char* pcError = dlerror(); |
| 1733 | |
| 1734 | if (pcError) { |
| 1735 | |
| 1736 | strError = pcError; |
| 1737 | } else { |
| 1738 | |
| 1739 | strError = "Unable to load libremote-processor.so library"; |
| 1740 | } |
| 1741 | |
| 1742 | return false; |
| 1743 | } |
| 1744 | |
| 1745 | CreateRemoteProcessorServer pfnCreateRemoteProcessorServer = (CreateRemoteProcessorServer)dlsym(lib_handle, "createRemoteProcessorServer"); |
| 1746 | |
| 1747 | if (!pfnCreateRemoteProcessorServer) { |
| 1748 | |
| 1749 | strError = "libremote-process.so does not contain createRemoteProcessorServer symbol."; |
| 1750 | |
| 1751 | return false; |
| 1752 | } |
| 1753 | |
| 1754 | // Create server |
| 1755 | _pRemoteProcessorServer = pfnCreateRemoteProcessorServer(_pSystemClassConfiguration->getServerPort(), this); |
| 1756 | |
| 1757 | // Compute max command usage length |
| 1758 | setMaxCommandUsageLength(); |
| 1759 | |
| 1760 | log("Starting remote processor server on port %d", _pSystemClassConfiguration->getServerPort()); |
| 1761 | // Start |
| 1762 | if (!_pRemoteProcessorServer->start()) { |
| 1763 | |
| 1764 | strError = "Unable to start remote processor server"; |
| 1765 | |
| 1766 | return false; |
| 1767 | } |
| 1768 | } |
| 1769 | |
| 1770 | return true; |
| 1771 | } |
| 1772 | |
| 1773 | // Back synchronization |
| 1774 | CBackSynchronizer* CParameterMgr::createBackSynchronizer(string& strError) const |
| 1775 | { |
| 1776 | #ifdef SIMULATION |
| 1777 | // In simulation, back synchronization of the blackboard won't probably work |
| 1778 | // We need to ensure though the blackboard is initialized with valid data |
| 1779 | return new CSimulatedBackSynchronizer(getConstSystemClass(), strError, _pMainParameterBlackboard); |
| 1780 | #else |
| 1781 | // Real back synchronizer from subsystems |
| 1782 | return new CHardwareBackSynchronizer(getConstSystemClass(), strError, _pMainParameterBlackboard); |
| 1783 | #endif |
| 1784 | } |
| 1785 | |
| 1786 | // Children typwise access |
| 1787 | CParameterFrameworkConfiguration* CParameterMgr::getFrameworkConfiguration() |
| 1788 | { |
| 1789 | return static_cast<CParameterFrameworkConfiguration*>(getChild(EFrameworkConfiguration)); |
| 1790 | } |
| 1791 | |
| 1792 | const CParameterFrameworkConfiguration* CParameterMgr::getConstFrameworkConfiguration() |
| 1793 | { |
| 1794 | return getFrameworkConfiguration(); |
| 1795 | } |
| 1796 | |
| 1797 | CSelectionCriteria* CParameterMgr::getSelectionCriteria() |
| 1798 | { |
| 1799 | return static_cast<CSelectionCriteria*>(getChild(ESelectionCriteria)); |
| 1800 | } |
| 1801 | |
| 1802 | const CSelectionCriteria* CParameterMgr::getConstSelectionCriteria() |
| 1803 | { |
| 1804 | return static_cast<const CSelectionCriteria*>(getChild(ESelectionCriteria)); |
| 1805 | } |
| 1806 | |
| 1807 | CSystemClass* CParameterMgr::getSystemClass() |
| 1808 | { |
| 1809 | return static_cast<CSystemClass*>(getChild(ESystemClass)); |
| 1810 | } |
| 1811 | |
| 1812 | const CSystemClass* CParameterMgr::getConstSystemClass() const |
| 1813 | { |
| 1814 | return static_cast<const CSystemClass*>(getChild(ESystemClass)); |
| 1815 | } |
| 1816 | |
| 1817 | // Configurable Domains |
| 1818 | CConfigurableDomains* CParameterMgr::getConfigurableDomains() |
| 1819 | { |
| 1820 | return static_cast<CConfigurableDomains*>(getChild(EConfigurableDomains)); |
| 1821 | } |
| 1822 | |
| 1823 | const CConfigurableDomains* CParameterMgr::getConstConfigurableDomains() |
| 1824 | { |
| 1825 | return static_cast<const CConfigurableDomains*>(getChild(EConfigurableDomains)); |
| 1826 | } |
| 1827 | |
| 1828 | const CConfigurableDomains* CParameterMgr::getConstConfigurableDomains() const |
| 1829 | { |
| 1830 | return static_cast<const CConfigurableDomains*>(getChild(EConfigurableDomains)); |
| 1831 | } |