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