| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 1 | /* |
| David Wagner | b76c9d6 | 2014-02-05 18:30:24 +0100 | [diff] [blame] | 2 | * Copyright (c) 2011-2014, Intel Corporation |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without modification, |
| 6 | * are permitted provided that the following conditions are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright notice, this |
| 9 | * list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 12 | * this list of conditions and the following disclaimer in the documentation and/or |
| 13 | * other materials provided with the distribution. |
| 14 | * |
| 15 | * 3. Neither the name of the copyright holder nor the names of its contributors |
| 16 | * may be used to endorse or promote products derived from this software without |
| 17 | * specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 29 | */ |
| 30 | #include "ParameterMgr.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 31 | #include "XmlParameterSerializingContext.h" |
| 32 | #include "XmlElementSerializingContext.h" |
| 33 | #include "SystemClass.h" |
| 34 | #include "ElementLibrarySet.h" |
| 35 | #include "SubsystemLibrary.h" |
| 36 | #include "NamedElementBuilderTemplate.h" |
| 37 | #include "KindElementBuilderTemplate.h" |
| 38 | #include "ElementBuilderTemplate.h" |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 39 | #include "XmlFileIncluderElement.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 40 | #include "SelectionCriterionType.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 41 | #include "SubsystemElementBuilder.h" |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 42 | #include "FileIncluderElementBuilder.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 43 | #include "SelectionCriteria.h" |
| 44 | #include "ComponentType.h" |
| 45 | #include "ComponentInstance.h" |
| 46 | #include "ParameterBlockType.h" |
| 47 | #include "BooleanParameterType.h" |
| 48 | #include "IntegerParameterType.h" |
| 49 | #include "FixedPointParameterType.h" |
| 50 | #include "ParameterBlackboard.h" |
| 51 | #include "Parameter.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 52 | #include "ParameterAccessContext.h" |
| 53 | #include "XmlFileIncluderElement.h" |
| 54 | #include "ParameterFrameworkConfiguration.h" |
| 55 | #include "FrameworkConfigurationGroup.h" |
| Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 56 | #include "PluginLocation.h" |
| 57 | #include "SubsystemPlugins.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 58 | #include "FrameworkConfigurationLocation.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 59 | #include "ConfigurableDomains.h" |
| 60 | #include "ConfigurableDomain.h" |
| 61 | #include "DomainConfiguration.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 62 | #include "XmlDomainSerializingContext.h" |
| David Wagner | 29fa61f | 2014-12-19 11:15:02 +0100 | [diff] [blame] | 63 | #include "XmlDomainExportContext.h" |
| 64 | #include "XmlDomainImportContext.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 65 | #include "BitParameterBlockType.h" |
| 66 | #include "BitParameterType.h" |
| Patrick Benavoli | 1352ae5 | 2011-10-21 16:48:04 +0200 | [diff] [blame] | 67 | #include "StringParameterType.h" |
| Patrick Benavoli | 9fc3c0d | 2011-10-27 14:27:27 +0200 | [diff] [blame] | 68 | #include "EnumParameterType.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 69 | #include "RemoteProcessorServerInterface.h" |
| 70 | #include "ElementLocator.h" |
| 71 | #include "AutoLog.h" |
| 72 | #include "CompoundRule.h" |
| 73 | #include "SelectionCriterionRule.h" |
| 74 | #include "SimulatedBackSynchronizer.h" |
| 75 | #include "HardwareBackSynchronizer.h" |
| Patrick Benavoli | 1387bda | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 76 | #include "AutoLock.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 77 | #include <strings.h> |
| 78 | #include <dlfcn.h> |
| 79 | #include <assert.h> |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 80 | #include "ParameterHandle.h" |
| Patrick Benavoli | ee65e6d | 2011-11-20 18:52:24 +0100 | [diff] [blame] | 81 | #include "LinearParameterAdaptation.h" |
| Patrick Benavoli | 68808c6 | 2012-02-02 17:12:41 +0100 | [diff] [blame] | 82 | #include "EnumValuePair.h" |
| Frederic Boisnard | 6cae0ec | 2013-05-23 18:48:58 +0200 | [diff] [blame] | 83 | #include "Subsystem.h" |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 84 | #include "XmlFileDocSink.h" |
| 85 | #include "XmlFileDocSource.h" |
| 86 | #include "XmlStringDocSink.h" |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 87 | #include "XmlStringDocSource.h" |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 88 | #include "XmlMemoryDocSink.h" |
| 89 | #include "XmlMemoryDocSource.h" |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 90 | #include "Utility.h" |
| Frédéric Boisnard | 6c55e9a | 2014-01-10 18:46:33 +0100 | [diff] [blame] | 91 | #include <sstream> |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 92 | |
| 93 | #define base CElement |
| 94 | |
| Sebastien Gonzalve | d952649 | 2014-02-20 22:28:03 +0100 | [diff] [blame] | 95 | using std::string; |
| 96 | using std::list; |
| 97 | using std::vector; |
| 98 | using std::ostringstream; |
| 99 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 100 | // Used for remote processor server creation |
| 101 | typedef IRemoteProcessorServerInterface* (*CreateRemoteProcessorServer)(uint16_t uiPort, IRemoteCommandHandler* pCommandHandler); |
| 102 | |
| 103 | // Global configuration file name (fixed) |
| 104 | const char* gacParameterFrameworkConfigurationFileName = "ParameterFrameworkConfiguration.xml"; |
| 105 | const char* gacSystemSchemasSubFolder = "Schemas"; |
| 106 | |
| 107 | // Config File System looks normally like this: |
| 108 | // --------------------------------------------- |
| Kevin Rocard | 03b7384 | 2014-10-01 18:20:41 +0200 | [diff] [blame] | 109 | //|-- <ParameterFrameworkConfiguration>.xml |
| 110 | //|-- Schemas |
| 111 | //| `-- *.xsd |
| 112 | //|-- Settings |
| 113 | //| `-- <SystemClassName folder>* |
| 114 | //| |-- <ConfigurableDomains>.xml |
| 115 | //| `-- <Settings>.bin? |
| 116 | //`-- Structure |
| 117 | // `-- <SystemClassName folder>* |
| 118 | // |-- <SystemClassName>Class.xml |
| 119 | // `-- <Subsystem>.xml* |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 120 | // -------------------------------------------- |
| 121 | |
| 122 | |
| 123 | // Remote command parser array |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 124 | const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandParserItems[] = { |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 125 | |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 126 | /// Version |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 127 | { "version", &CParameterMgr::versionCommandProcess, 0, |
| 128 | "", "Show version" }, |
| 129 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 130 | /// Status |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 131 | { "status", &CParameterMgr::statusCommandProcess, 0, "", |
| 132 | "Show current status" }, |
| 133 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 134 | /// Tuning Mode |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 135 | { "setTuningMode", &CParameterMgr::setTuningModeCommmandProcess, 1, |
| 136 | "on|off*", "Turn on or off Tuning Mode" }, |
| 137 | { "getTuningMode", &CParameterMgr::getTuningModeCommmandProcess, 0, |
| 138 | "", "Show Tuning Mode" }, |
| 139 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 140 | /// Value Space |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 141 | { "setValueSpace", &CParameterMgr::setValueSpaceCommmandProcess, 1, |
| 142 | "raw|real*", "Assigns Value Space used for parameter value interpretation" }, |
| 143 | { "getValueSpace", &CParameterMgr::getValueSpaceCommmandProcess, 0, |
| 144 | "", "Show Value Space" }, |
| 145 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 146 | /// Output Raw Format |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 147 | { "setOutputRawFormat", &CParameterMgr::setOutputRawFormatCommmandProcess, 1, |
| 148 | "dec*|hex", "Assigns format used to output parameter values when in raw Value Space" }, |
| 149 | { "getOutputRawFormat", &CParameterMgr::getOutputRawFormatCommmandProcess, 0, |
| 150 | "", "Show Output Raw Format" }, |
| 151 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 152 | /// Sync |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 153 | { "setAutoSync", &CParameterMgr::setAutoSyncCommmandProcess, 1, |
| 154 | "on*|off", "Turn on or off automatic synchronization to hardware while in Tuning Mode" }, |
| 155 | { "getAutoSync", &CParameterMgr::getAutoSyncCommmandProcess, 0, |
| 156 | "", "Show Auto Sync state" }, |
| 157 | { "sync", &CParameterMgr::syncCommmandProcess, 0, |
| 158 | "", "Synchronize current settings to hardware while in Tuning Mode and Auto Sync off" }, |
| 159 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 160 | /// Criteria |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 161 | { "listCriteria", &CParameterMgr::listCriteriaCommmandProcess, 0, |
| 162 | "[csv]", "List selection criteria" }, |
| 163 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 164 | /// Domains |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 165 | { "listDomains", &CParameterMgr::listDomainsCommmandProcess, 0, |
| 166 | "", "List configurable domains" }, |
| 167 | { "dumpDomains", &CParameterMgr::dumpDomainsCommmandProcess, 0, |
| 168 | "", "Show all domains and configurations, including applicability conditions" }, |
| 169 | { "createDomain", &CParameterMgr::createDomainCommmandProcess, 1, |
| 170 | "<domain>", "Create new configurable domain" }, |
| 171 | { "deleteDomain", &CParameterMgr::deleteDomainCommmandProcess, 1, |
| 172 | "<domain>", "Delete configurable domain" }, |
| 173 | { "deleteAllDomains", &CParameterMgr::deleteAllDomainsCommmandProcess, 0, |
| 174 | "", "Delete all configurable domains" }, |
| 175 | { "renameDomain", &CParameterMgr::renameDomainCommmandProcess, 2, |
| 176 | "<domain> <new name>", "Rename configurable domain" }, |
| 177 | { "setSequenceAwareness", &CParameterMgr::setSequenceAwarenessCommmandProcess, 1, |
| 178 | "<domain> true|false*", "Set configurable domain sequence awareness" }, |
| 179 | { "getSequenceAwareness", &CParameterMgr::getSequenceAwarenessCommmandProcess, 1, |
| 180 | "<domain>", "Get configurable domain sequence awareness" }, |
| 181 | { "listDomainElements", &CParameterMgr::listDomainElementsCommmandProcess, 1, |
| 182 | "<domain>", "List elements associated to configurable domain" }, |
| 183 | { "addElement", &CParameterMgr::addElementCommmandProcess, 2, |
| 184 | "<domain> <elem path>", "Associate element at given path to configurable domain" }, |
| 185 | { "removeElement", &CParameterMgr::removeElementCommmandProcess, 2, |
| 186 | "<domain> <elem path>", "Dissociate element at given path from configurable domain" }, |
| 187 | { "splitDomain", &CParameterMgr::splitDomainCommmandProcess, 2, |
| 188 | "<domain> <elem path>", "Split configurable domain at given associated element path" }, |
| 189 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 190 | /// Configurations |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 191 | { "listConfigurations", &CParameterMgr::listConfigurationsCommmandProcess, 1, |
| 192 | "<domain>", "List domain configurations" }, |
| 193 | { "createConfiguration", &CParameterMgr::createConfigurationCommmandProcess, 2, |
| 194 | "<domain> <configuration>", "Create new domain configuration" }, |
| 195 | { "deleteConfiguration", &CParameterMgr::deleteConfigurationCommmandProcess, 2, |
| 196 | "<domain> <configuration>", "Delete domain configuration" }, |
| 197 | { "renameConfiguration", &CParameterMgr::renameConfigurationCommmandProcess, 3, |
| 198 | "<domain> <configuration> <new name>", "Rename domain configuration" }, |
| 199 | { "saveConfiguration", &CParameterMgr::saveConfigurationCommmandProcess, 2, |
| 200 | "<domain> <configuration>", "Save current settings into configuration" }, |
| 201 | { "restoreConfiguration", &CParameterMgr::restoreConfigurationCommmandProcess, 2, |
| 202 | "<domain> <configuration>", "Restore current settings from configuration" }, |
| 203 | { "setElementSequence", &CParameterMgr::setElementSequenceCommmandProcess, 3, |
| 204 | "<domain> <configuration> <elem path list>", |
| 205 | "Set element application order for configuration" }, |
| 206 | { "getElementSequence", &CParameterMgr::getElementSequenceCommmandProcess, 2, |
| 207 | "<domain> <configuration>", "Get element application order for configuration" }, |
| 208 | { "setRule", &CParameterMgr::setRuleCommmandProcess, 3, |
| 209 | "<domain> <configuration> <rule>", "Set configuration application rule" }, |
| 210 | { "clearRule", &CParameterMgr::clearRuleCommmandProcess, 2, |
| 211 | "<domain> <configuration>", "Clear configuration application rule" }, |
| 212 | { "getRule", &CParameterMgr::getRuleCommmandProcess, 2, |
| 213 | "<domain> <configuration>", "Get configuration application rule" }, |
| 214 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 215 | /// Elements/Parameters |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 216 | { "listElements", &CParameterMgr::listElementsCommmandProcess, 1, |
| 217 | "<elem path>|/", "List elements under element at given path or root" }, |
| 218 | { "listParameters", &CParameterMgr::listParametersCommmandProcess, 1, |
| 219 | "<elem path>|/", "List parameters under element at given path or root" }, |
| 220 | { "dumpElement", &CParameterMgr::dumpElementCommmandProcess, 1, |
| 221 | "<elem path>", "Dump structure and content of element at given path" }, |
| 222 | { "getElementSize", &CParameterMgr::getElementSizeCommmandProcess, 1, |
| 223 | "<elem path>", "Show size of element at given path" }, |
| 224 | { "showProperties", &CParameterMgr::showPropertiesCommmandProcess, 1, |
| 225 | "<elem path>", "Show properties of element at given path" }, |
| 226 | { "getParameter", &CParameterMgr::getParameterCommmandProcess, 1, |
| 227 | "<param path>", "Get value for parameter at given path" }, |
| 228 | { "setParameter", &CParameterMgr::setParameterCommmandProcess, 2, |
| 229 | "<param path> <value>", "Set value for parameter at given path" }, |
| 230 | { "listBelongingDomains", &CParameterMgr::listBelongingDomainsCommmandProcess, 1, |
| 231 | "<elem path>", "List domain(s) element at given path belongs to" }, |
| 232 | { "listAssociatedDomains", &CParameterMgr::listAssociatedDomainsCommmandProcess, 1, |
| 233 | "<elem path>", "List domain(s) element at given path is associated to" }, |
| 234 | { "getConfigurationParameter", &CParameterMgr::getConfigurationParameterCommmandProcess, 3, |
| 235 | "<domain> <configuration> <param path>", |
| 236 | "Get value for parameter at given path from configuration" }, |
| 237 | { "setConfigurationParameter", &CParameterMgr::setConfigurationParameterCommmandProcess, 4, |
| 238 | "<domain> <configuration> <param path> <value>", |
| 239 | "Set value for parameter at given path to configuration" }, |
| Frederic Boisnard | 6cae0ec | 2013-05-23 18:48:58 +0200 | [diff] [blame] | 240 | { "showMapping", &CParameterMgr::showMappingCommmandProcess, 1, |
| 241 | "<elem path>", "Show mapping for an element at given path" }, |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 242 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 243 | /// Browse |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 244 | { "listAssociatedElements", &CParameterMgr::listAssociatedElementsCommmandProcess, 0, |
| 245 | "", "List element sub-trees associated to at least one configurable domain" }, |
| 246 | { "listConflictingElements", &CParameterMgr::listConflictingElementsCommmandProcess, 0, |
| 247 | "", "List element sub-trees contained in more than one configurable domain" }, |
| 248 | { "listRogueElements", &CParameterMgr::listRogueElementsCommmandProcess, 0, |
| 249 | "", "List element sub-trees owned by no configurable domain" }, |
| 250 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 251 | /// Settings Import/Export |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 252 | { "exportDomainsXML", &CParameterMgr::exportConfigurableDomainsToXMLCommmandProcess, 1, |
| 253 | "<file path> ", "Export domains to XML file" }, |
| 254 | { "importDomainsXML", &CParameterMgr::importConfigurableDomainsFromXMLCommmandProcess, 1, |
| 255 | "<file path>", "Import domains from XML file" }, |
| 256 | { "exportDomainsWithSettingsXML", |
| 257 | &CParameterMgr::exportConfigurableDomainsWithSettingsToXMLCommmandProcess, 1, |
| 258 | "<file path> ", "Export domains including settings to XML file" }, |
| 259 | { "importDomainsWithSettingsXML", |
| 260 | &CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess, 1, |
| 261 | "<file path>", "Import domains including settings from XML file" }, |
| 262 | { "exportSettings", &CParameterMgr::exportSettingsCommmandProcess, 1, |
| 263 | "<file path>", "Export settings to binary file" }, |
| 264 | { "importSettings", &CParameterMgr::importSettingsCommmandProcess, 1, |
| 265 | "<file path>", "Import settings from binary file" }, |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 266 | { "getDomainsWithSettingsXML", |
| 267 | &CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess, 0, |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 268 | "", "Print domains including settings as XML" }, |
| David Wagner | ed744eb | 2014-12-04 18:38:52 +0100 | [diff] [blame^] | 269 | { "getDomainWithSettingsXML", |
| 270 | &CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess, 1, |
| 271 | "<domain>", "Print the given domain including settings as XML" }, |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 272 | { "setDomainsWithSettingsXML", |
| 273 | &CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess, 1, |
| 274 | "<xml configurable domains>", "Import domains including settings from XML string" }, |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 275 | /// Structure Export |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 276 | { "getSystemClassXML", &CParameterMgr::getSystemClassXMLCommmandProcess, 0 , |
| Kevin Rocard | c021157 | 2013-06-18 11:34:53 +0200 | [diff] [blame] | 277 | "", "Print parameter structure as XML" }, |
| 278 | /// Deprecated Commands |
| 279 | { "getDomainsXML", |
| 280 | &CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess, 0, |
| 281 | "", "DEPRECATED COMMAND, please use getDomainsWithSettingsXML" }, |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 282 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 283 | }; |
| Kevin Rocard | 3949b34 | 2013-05-24 18:43:53 +0200 | [diff] [blame] | 284 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 285 | // Remote command parsers array Size |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 286 | const uint32_t CParameterMgr::guiNbRemoteCommandParserItems = sizeof(gastRemoteCommandParserItems) / sizeof(gastRemoteCommandParserItems[0]); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 287 | |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 288 | CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) : |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 289 | _bTuningModeIsOn(false), |
| 290 | _bValueSpaceIsRaw(false), |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 291 | _bOutputRawFormatIsHex(false), |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 292 | _bAutoSyncOn(true), |
| 293 | _pMainParameterBlackboard(new CParameterBlackboard), |
| 294 | _pElementLibrarySet(new CElementLibrarySet), |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 295 | _strXmlConfigurationFilePath(strConfigurationFilePath), |
| Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 296 | _pSubsystemPlugins(NULL), |
| Renaud de Chivre | 1b8b3ca | 2013-12-13 15:09:44 +0100 | [diff] [blame] | 297 | _handleLibRemoteProcessor(NULL), |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 298 | _uiStructureChecksum(0), |
| 299 | _pRemoteProcessorServer(NULL), |
| 300 | _uiMaxCommandUsageLength(0), |
| 301 | _pLogger(NULL), |
| Kevin Rocard | ecf9310 | 2013-07-10 18:28:10 +0200 | [diff] [blame] | 302 | _uiLogDepth(0), |
| Kevin Rocard | d6909eb | 2013-07-18 09:13:51 +0200 | [diff] [blame] | 303 | _bFailOnMissingSubsystem(true), |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 304 | _bFailOnFailedSettingsLoad(true), |
| 305 | _bValidateSchemasOnStart(false) |
| 306 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 307 | { |
| 308 | // Tuning Mode Mutex |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 309 | bzero(&_blackboardMutex, sizeof(_blackboardMutex)); |
| 310 | pthread_mutex_init(&_blackboardMutex, NULL); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 311 | |
| 312 | // Deal with children |
| 313 | addChild(new CParameterFrameworkConfiguration); |
| 314 | addChild(new CSelectionCriteria); |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 315 | addChild(new CSystemClass); |
| 316 | addChild(new CConfigurableDomains); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 317 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 318 | _pCommandHandler = new CCommandHandler(this); |
| 319 | |
| 320 | // Add command parsers |
| 321 | uint32_t uiRemoteCommandParserItem; |
| 322 | |
| 323 | for (uiRemoteCommandParserItem = 0; uiRemoteCommandParserItem < guiNbRemoteCommandParserItems; uiRemoteCommandParserItem++) { |
| 324 | |
| 325 | const SRemoteCommandParserItem* pRemoteCommandParserItem = &gastRemoteCommandParserItems[uiRemoteCommandParserItem]; |
| 326 | |
| 327 | _pCommandHandler->addCommandParser(pRemoteCommandParserItem->_pcCommandName, |
| 328 | pRemoteCommandParserItem->_pfnParser, |
| 329 | pRemoteCommandParserItem->_uiMinArgumentCount, |
| 330 | pRemoteCommandParserItem->_pcHelp, |
| 331 | pRemoteCommandParserItem->_pcDescription); |
| 332 | } |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 333 | |
| 334 | // Configuration file folder |
| 335 | uint32_t uiSlashPos = _strXmlConfigurationFilePath.rfind('/', -1); |
| 336 | |
| 337 | assert(uiSlashPos != (uint32_t)-1); |
| 338 | |
| 339 | _strXmlConfigurationFolderPath = _strXmlConfigurationFilePath.substr(0, uiSlashPos); |
| 340 | |
| 341 | // Schema absolute folder location |
| 342 | _strSchemaFolderLocation = _strXmlConfigurationFolderPath + "/" + gacSystemSchemasSubFolder; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 343 | } |
| 344 | |
| 345 | CParameterMgr::~CParameterMgr() |
| 346 | { |
| 347 | // Children |
| 348 | delete _pRemoteProcessorServer; |
| Frederic Boisnard | 3124230 | 2012-04-26 17:07:34 +0200 | [diff] [blame] | 349 | delete _pCommandHandler; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 350 | delete _pMainParameterBlackboard; |
| 351 | delete _pElementLibrarySet; |
| 352 | |
| Renaud de Chivre | 1b8b3ca | 2013-12-13 15:09:44 +0100 | [diff] [blame] | 353 | // Close remote processor library |
| 354 | if (_handleLibRemoteProcessor != NULL) { |
| 355 | dlclose(_handleLibRemoteProcessor); |
| 356 | } |
| 357 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 358 | // Tuning Mode Mutex |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 359 | pthread_mutex_destroy(&_blackboardMutex); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | string CParameterMgr::getKind() const |
| 363 | { |
| 364 | return "ParameterMgr"; |
| 365 | } |
| 366 | |
| 367 | // Logging |
| 368 | void CParameterMgr::setLogger(CParameterMgr::ILogger* pLogger) |
| 369 | { |
| 370 | _pLogger = pLogger; |
| 371 | } |
| 372 | |
| 373 | // Logging |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 374 | void CParameterMgr::doLog(bool bIsWarning, const string& strLog) const |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 375 | { |
| 376 | if (_pLogger) { |
| 377 | |
| 378 | // Nest |
| 379 | string strIndent; |
| 380 | |
| 381 | // Level |
| 382 | uint32_t uiNbIndents = _uiLogDepth; |
| 383 | |
| 384 | while (uiNbIndents--) { |
| 385 | |
| 386 | strIndent += " "; |
| 387 | } |
| 388 | |
| 389 | // Log |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 390 | _pLogger->log(bIsWarning, strIndent + strLog); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 391 | } |
| 392 | } |
| 393 | |
| 394 | void CParameterMgr::nestLog() const |
| 395 | { |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 396 | _uiLogDepth++; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | void CParameterMgr::unnestLog() const |
| 400 | { |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 401 | _uiLogDepth--; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 402 | } |
| 403 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 404 | // Version |
| 405 | string CParameterMgr::getVersion() const |
| 406 | { |
| 407 | string strVersion; |
| 408 | |
| 409 | // Major |
| 410 | strVersion = toString(guiEditionMajor) + "."; |
| 411 | // Minor |
| 412 | strVersion += toString(guiEditionMinor) + "."; |
| 413 | // Revision |
| 414 | strVersion += toString(guiRevision); |
| 415 | |
| 416 | return strVersion; |
| 417 | } |
| 418 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 419 | bool CParameterMgr::load(string& strError) |
| 420 | { |
| 421 | CAutoLog autoLog(this, "Loading"); |
| 422 | |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 423 | feedElementLibraries(); |
| 424 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 425 | // Load Framework configuration |
| 426 | if (!loadFrameworkConfiguration(strError)) { |
| 427 | |
| 428 | return false; |
| 429 | } |
| 430 | |
| 431 | // Load subsystems |
| Kevin Rocard | ecf9310 | 2013-07-10 18:28:10 +0200 | [diff] [blame] | 432 | if (!getSystemClass()->loadSubsystems(strError, |
| 433 | _pSubsystemPlugins, !_bFailOnMissingSubsystem)) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 434 | |
| 435 | return false; |
| 436 | } |
| 437 | |
| 438 | // Load structure |
| 439 | if (!loadStructure(strError)) { |
| 440 | |
| 441 | return false; |
| 442 | } |
| 443 | |
| 444 | // Load settings |
| 445 | if (!loadSettings(strError)) { |
| 446 | |
| 447 | return false; |
| 448 | } |
| 449 | |
| Patrick Benavoli | 1387bda | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 450 | // Back synchronization for areas in parameter blackboard not covered by any domain |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 451 | CBackSynchronizer* pBackSynchronizer = createBackSynchronizer(); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 452 | |
| Patrick Benavoli | 1387bda | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 453 | // Back-synchronize |
| Kevin Rocard | 57096bd | 2012-11-30 11:24:20 +0100 | [diff] [blame] | 454 | { |
| 455 | CAutoLog autoLog(this, "Main blackboard back synchronization"); |
| 456 | |
| Kevin Rocard | 5d6e05a | 2013-01-21 15:57:45 +0100 | [diff] [blame] | 457 | pBackSynchronizer->sync(); |
| Kevin Rocard | 57096bd | 2012-11-30 11:24:20 +0100 | [diff] [blame] | 458 | |
| Patrick Benavoli | 1387bda | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 459 | // Get rid of back synchronizer |
| 460 | delete pBackSynchronizer; |
| Patrick Benavoli | 1387bda | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 461 | } |
| Patrick Benavoli | 1387bda | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 462 | |
| 463 | // We're done loading the settings and back synchronizing |
| 464 | CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); |
| 465 | |
| 466 | // We need to ensure all domains are valid |
| 467 | pConfigurableDomains->validate(_pMainParameterBlackboard); |
| 468 | |
| Kevin Rocard | 7f26582 | 2012-12-07 18:51:22 +0100 | [diff] [blame] | 469 | // Log selection criterion states |
| 470 | { |
| 471 | CAutoLog autoLog(this, "Criterion states"); |
| 472 | |
| 473 | const CSelectionCriteria* selectionCriteria = getConstSelectionCriteria(); |
| 474 | |
| 475 | list<string> lstrSelectionCriteron; |
| 476 | selectionCriteria->listSelectionCriteria(lstrSelectionCriteron, true, false); |
| 477 | |
| Kevin Rocard | 3629936 | 2013-02-04 14:57:47 +0100 | [diff] [blame] | 478 | log_table(false, lstrSelectionCriteron); |
| Kevin Rocard | 7f26582 | 2012-12-07 18:51:22 +0100 | [diff] [blame] | 479 | } |
| 480 | |
| Kevin Rocard | 2fbe6e8 | 2013-03-26 17:09:29 +0100 | [diff] [blame] | 481 | // Subsystem can not ask for resync as they have not been synced yet |
| 482 | getSystemClass()->cleanSubsystemsNeedToResync(); |
| 483 | |
| Guillaume Denneulin | f2fd15a | 2012-12-20 17:53:29 +0100 | [diff] [blame] | 484 | // At initialization, check subsystems that need resync |
| 485 | doApplyConfigurations(true); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 486 | |
| Patrick Benavoli | 1387bda | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 487 | // Start remote processor server if appropriate |
| 488 | return handleRemoteProcessingInterface(strError); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 489 | } |
| 490 | |
| 491 | bool CParameterMgr::loadFrameworkConfiguration(string& strError) |
| 492 | { |
| 493 | CAutoLog autoLog(this, "Loading framework configuration"); |
| 494 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 495 | // Parse Structure XML file |
| 496 | CXmlElementSerializingContext elementSerializingContext(strError); |
| 497 | |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 498 | if (!xmlParse(elementSerializingContext, getFrameworkConfiguration(), _strXmlConfigurationFilePath, _strXmlConfigurationFolderPath, EFrameworkConfigurationLibrary)) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 499 | |
| 500 | return false; |
| 501 | } |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 502 | // Set class name to system class and configurable domains |
| 503 | getSystemClass()->setName(getConstFrameworkConfiguration()->getSystemClassName()); |
| 504 | getConfigurableDomains()->setName(getConstFrameworkConfiguration()->getSystemClassName()); |
| 505 | |
| Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 506 | // Get subsystem plugins elements |
| 507 | _pSubsystemPlugins = static_cast<const CSubsystemPlugins*>(getConstFrameworkConfiguration()->findChild("SubsystemPlugins")); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 508 | |
| Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 509 | if (!_pSubsystemPlugins) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 510 | |
| Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 511 | strError = "Parameter Framework Configuration: couldn't find SubsystemPlugins element"; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 512 | |
| 513 | return false; |
| 514 | } |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 515 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 516 | // Log tuning availability |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 517 | log_info("Tuning %s", getConstFrameworkConfiguration()->isTuningAllowed() ? "allowed" : "prohibited"); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 518 | |
| 519 | return true; |
| 520 | } |
| 521 | |
| 522 | bool CParameterMgr::loadStructure(string& strError) |
| 523 | { |
| 524 | // Retrieve system to load structure to |
| 525 | CSystemClass* pSystemClass = getSystemClass(); |
| 526 | |
| Kevin Rocard | e25ee79 | 2013-04-22 17:46:28 +0200 | [diff] [blame] | 527 | log_info("Loading " + pSystemClass->getName() + " system class structure"); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 528 | |
| 529 | // Get structure description element |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 530 | const CFrameworkConfigurationLocation* pStructureDescriptionFileLocation = static_cast<const CFrameworkConfigurationLocation*>(getConstFrameworkConfiguration()->findChildOfKind("StructureDescriptionFileLocation")); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 531 | |
| 532 | if (!pStructureDescriptionFileLocation) { |
| 533 | |
| 534 | strError = "No StructureDescriptionFileLocation element found for SystemClass " + pSystemClass->getName(); |
| 535 | |
| 536 | return false; |
| 537 | } |
| 538 | |
| 539 | // Get Xml structure folder |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 540 | string strXmlStructureFolder = pStructureDescriptionFileLocation->getFolderPath(_strXmlConfigurationFolderPath); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 541 | |
| 542 | // Get Xml structure file name |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 543 | string strXmlStructureFilePath = pStructureDescriptionFileLocation->getFilePath(_strXmlConfigurationFolderPath); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 544 | |
| 545 | // Parse Structure XML file |
| 546 | CXmlParameterSerializingContext parameterBuildContext(strError); |
| 547 | |
| Kevin Rocard | 57096bd | 2012-11-30 11:24:20 +0100 | [diff] [blame] | 548 | CAutoLog autolog(pSystemClass, "Importing system structure from file " + strXmlStructureFilePath); |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 549 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 550 | if (!xmlParse(parameterBuildContext, pSystemClass, strXmlStructureFilePath, strXmlStructureFolder, EParameterCreationLibrary)) { |
| 551 | |
| 552 | return false; |
| 553 | } |
| 554 | |
| 555 | // Initialize offsets |
| 556 | pSystemClass->setOffset(0); |
| 557 | |
| 558 | // Initialize main blackboard's size |
| 559 | _pMainParameterBlackboard->setSize(pSystemClass->getFootPrint()); |
| 560 | |
| 561 | return true; |
| 562 | } |
| 563 | |
| 564 | bool CParameterMgr::loadSettings(string& strError) |
| 565 | { |
| Kevin Rocard | d6909eb | 2013-07-18 09:13:51 +0200 | [diff] [blame] | 566 | string strLoadError; |
| 567 | bool success = loadSettingsFromConfigFile(strLoadError); |
| 568 | |
| 569 | if (!success && !_bFailOnFailedSettingsLoad) { |
| 570 | // Load can not fail, ie continue but log the load errors |
| 571 | log_info(strLoadError); |
| 572 | log_info("Failed to load settings, continue without domains."); |
| 573 | success = true; |
| 574 | } |
| 575 | |
| 576 | if (!success) { |
| 577 | // Propagate the litteral error only if the function fails |
| 578 | strError = strLoadError; |
| 579 | return false; |
| 580 | } |
| 581 | |
| 582 | return true; |
| 583 | } |
| 584 | |
| 585 | bool CParameterMgr::loadSettingsFromConfigFile(string& strError) |
| 586 | { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 587 | CAutoLog autoLog(this, "Loading settings"); |
| 588 | |
| 589 | // Get settings configuration element |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 590 | const CFrameworkConfigurationGroup* pParameterConfigurationGroup = static_cast<const CFrameworkConfigurationGroup*>(getConstFrameworkConfiguration()->findChildOfKind("SettingsConfiguration")); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 591 | |
| 592 | if (!pParameterConfigurationGroup) { |
| 593 | |
| 594 | // No settings to load |
| 595 | |
| 596 | return true; |
| 597 | } |
| 598 | // Get binary settings file location |
| 599 | const CFrameworkConfigurationLocation* pBinarySettingsFileLocation = static_cast<const CFrameworkConfigurationLocation*>(pParameterConfigurationGroup->findChildOfKind("BinarySettingsFileLocation")); |
| 600 | |
| 601 | string strXmlBinarySettingsFilePath; |
| 602 | |
| 603 | if (pBinarySettingsFileLocation) { |
| 604 | |
| 605 | // Get Xml binary settings file name |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 606 | strXmlBinarySettingsFilePath = pBinarySettingsFileLocation->getFilePath(_strXmlConfigurationFolderPath); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | // Get configurable domains element |
| 610 | const CFrameworkConfigurationLocation* pConfigurableDomainsFileLocation = static_cast<const CFrameworkConfigurationLocation*>(pParameterConfigurationGroup->findChildOfKind("ConfigurableDomainsFileLocation")); |
| 611 | |
| 612 | if (!pConfigurableDomainsFileLocation) { |
| 613 | |
| 614 | strError = "No ConfigurableDomainsFileLocation element found for SystemClass " + getSystemClass()->getName(); |
| 615 | |
| 616 | return false; |
| Kevin Rocard | d6909eb | 2013-07-18 09:13:51 +0200 | [diff] [blame] | 617 | } |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 618 | // Get destination root element |
| 619 | CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); |
| 620 | |
| 621 | // Get Xml configuration domains file name |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 622 | string strXmlConfigurationDomainsFilePath = pConfigurableDomainsFileLocation->getFilePath(_strXmlConfigurationFolderPath); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 623 | |
| 624 | // Get Xml configuration domains folder |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 625 | string strXmlConfigurationDomainsFolder = pConfigurableDomainsFileLocation->getFolderPath(_strXmlConfigurationFolderPath); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 626 | |
| 627 | // Parse configuration domains XML file (ask to read settings from XML file if they are not provided as binary) |
| David Wagner | d8a5310 | 2014-12-10 14:49:23 +0100 | [diff] [blame] | 628 | CXmlDomainImportContext xmlDomainImportContext(strError, !pBinarySettingsFileLocation, |
| 629 | *getSystemClass()); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 630 | |
| 631 | // Selection criteria definition for rule creation |
| David Wagner | 29fa61f | 2014-12-19 11:15:02 +0100 | [diff] [blame] | 632 | xmlDomainImportContext.setSelectionCriteriaDefinition(getConstSelectionCriteria()->getSelectionCriteriaDefinition()); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 633 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 634 | // Auto validation of configurations if no binary settings provided |
| David Wagner | 29fa61f | 2014-12-19 11:15:02 +0100 | [diff] [blame] | 635 | xmlDomainImportContext.setAutoValidationRequired(!pBinarySettingsFileLocation); |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 636 | |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 637 | log_info("Importing configurable domains from file %s %s settings", strXmlConfigurationDomainsFilePath.c_str(), pBinarySettingsFileLocation ? "without" : "with"); |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 638 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 639 | // Do parse |
| David Wagner | 29fa61f | 2014-12-19 11:15:02 +0100 | [diff] [blame] | 640 | if (!xmlParse(xmlDomainImportContext, pConfigurableDomains, strXmlConfigurationDomainsFilePath, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 641 | |
| 642 | return false; |
| 643 | } |
| 644 | // We have loaded the whole system structure, compute checksum |
| 645 | const CSystemClass* pSystemClass = getConstSystemClass(); |
| 646 | _uiStructureChecksum = pSystemClass->computeStructureChecksum() + getConfigurableDomains()->computeStructureChecksum() + getSelectionCriteria()->computeStructureChecksum(); |
| 647 | |
| 648 | // Load binary settings if any provided |
| 649 | if (pBinarySettingsFileLocation && !pConfigurableDomains->serializeSettings(strXmlBinarySettingsFilePath, false, _uiStructureChecksum, strError)) { |
| 650 | |
| 651 | return false; |
| 652 | } |
| 653 | |
| Patrick Benavoli | 1387bda | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 654 | return true; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 655 | } |
| 656 | |
| 657 | // XML parsing |
| 658 | bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const string& strXmlFilePath, const string& strXmlFolder, CParameterMgr::ElementLibrary eElementLibrary, const string& strNameAttrituteName) |
| 659 | { |
| 660 | // Init serializing context |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 661 | elementSerializingContext.set(_pElementLibrarySet->getElementLibrary( |
| 662 | eElementLibrary), strXmlFolder, _strSchemaFolderLocation); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 663 | |
| 664 | // Get Schema file associated to root element |
| 665 | string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + pRootElement->getKind() + ".xsd"; |
| 666 | |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 667 | CXmlFileDocSource fileDocSource(strXmlFilePath, strXmlSchemaFilePath, |
| 668 | pRootElement->getKind(), |
| 669 | pRootElement->getName(), strNameAttrituteName, |
| 670 | _bValidateSchemasOnStart); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 671 | |
| 672 | // Start clean |
| 673 | pRootElement->clean(); |
| 674 | |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 675 | CXmlMemoryDocSink memorySink(pRootElement); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 676 | |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 677 | if (!memorySink.process(fileDocSource, elementSerializingContext)) { |
| 678 | //Cleanup |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 679 | pRootElement->clean(); |
| 680 | |
| 681 | return false; |
| 682 | } |
| 683 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 684 | return true; |
| 685 | } |
| 686 | |
| 687 | // Init |
| 688 | bool CParameterMgr::init(string& strError) |
| 689 | { |
| 690 | return base::init(strError); |
| 691 | } |
| 692 | |
| 693 | // Selection criteria interface |
| 694 | CSelectionCriterionType* CParameterMgr::createSelectionCriterionType(bool bIsInclusive) |
| 695 | { |
| 696 | // Propagate |
| 697 | return getSelectionCriteria()->createSelectionCriterionType(bIsInclusive); |
| 698 | } |
| 699 | |
| 700 | CSelectionCriterion* CParameterMgr::createSelectionCriterion(const string& strName, const CSelectionCriterionType* pSelectionCriterionType) |
| 701 | { |
| 702 | // Propagate |
| 703 | return getSelectionCriteria()->createSelectionCriterion(strName, pSelectionCriterionType); |
| 704 | } |
| 705 | |
| Patrick Benavoli | b71ccf7 | 2011-09-13 14:15:52 +0200 | [diff] [blame] | 706 | // Selection criterion retrieval |
| 707 | CSelectionCriterion* CParameterMgr::getSelectionCriterion(const string& strName) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 708 | { |
| Patrick Benavoli | b71ccf7 | 2011-09-13 14:15:52 +0200 | [diff] [blame] | 709 | // Propagate |
| 710 | return getSelectionCriteria()->getSelectionCriterion(strName); |
| 711 | } |
| 712 | |
| Guillaume Denneulin | f2fd15a | 2012-12-20 17:53:29 +0100 | [diff] [blame] | 713 | // Configuration application |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 714 | void CParameterMgr::applyConfigurations() |
| Patrick Benavoli | b71ccf7 | 2011-09-13 14:15:52 +0200 | [diff] [blame] | 715 | { |
| 716 | CAutoLog autoLog(this, "Configuration application request"); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 717 | |
| 718 | // Lock state |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 719 | CAutoLock autoLock(&_blackboardMutex); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 720 | |
| 721 | if (!_bTuningModeIsOn) { |
| 722 | |
| 723 | // Apply configuration(s) |
| Guillaume Denneulin | f2fd15a | 2012-12-20 17:53:29 +0100 | [diff] [blame] | 724 | doApplyConfigurations(false); |
| Frédéric Boisnard | daaa63c | 2012-08-27 15:48:15 +0200 | [diff] [blame] | 725 | } else { |
| 726 | |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 727 | log_warning("Configurations were not applied because the TuningMode is on"); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 728 | } |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 729 | } |
| 730 | |
| Frederic Boisnard | 6cae0ec | 2013-05-23 18:48:58 +0200 | [diff] [blame] | 731 | // Get the configurableElement corresponding to the given path |
| 732 | const CConfigurableElement* CParameterMgr::getConfigurableElement(const string& strPath, |
| 733 | string& strError) const |
| Patrick Benavoli | 4bed921 | 2011-10-27 14:18:00 +0200 | [diff] [blame] | 734 | { |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 735 | CPathNavigator pathNavigator(strPath); |
| Patrick Benavoli | 4bed921 | 2011-10-27 14:18:00 +0200 | [diff] [blame] | 736 | |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 737 | // Nagivate through system class |
| 738 | if (!pathNavigator.navigateThrough(getConstSystemClass()->getName(), strError)) { |
| 739 | |
| Patrick Benavoli | 79f16cc | 2011-11-25 22:36:41 +0100 | [diff] [blame] | 740 | return NULL; |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 741 | } |
| 742 | |
| 743 | // Find element |
| 744 | const CElement* pElement = getConstSystemClass()->findDescendant(pathNavigator); |
| 745 | |
| 746 | if (!pElement) { |
| 747 | |
| Kevin Rocard | 4c3f8d8 | 2013-11-21 12:16:28 +0100 | [diff] [blame] | 748 | strError = "Path not found: " + strPath; |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 749 | |
| Patrick Benavoli | 79f16cc | 2011-11-25 22:36:41 +0100 | [diff] [blame] | 750 | return NULL; |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 751 | } |
| 752 | |
| 753 | // Check found element is a parameter |
| 754 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pElement); |
| 755 | |
| Frederic Boisnard | 6cae0ec | 2013-05-23 18:48:58 +0200 | [diff] [blame] | 756 | return pConfigurableElement; |
| 757 | } |
| 758 | |
| 759 | // Dynamic parameter handling |
| 760 | CParameterHandle* CParameterMgr::createParameterHandle(const string& strPath, string& strError) |
| 761 | { |
| 762 | const CConfigurableElement* pConfigurableElement = getConfigurableElement(strPath, strError); |
| 763 | |
| 764 | if (!pConfigurableElement) { |
| 765 | |
| 766 | // Element not found |
| Kevin Rocard | 4c3f8d8 | 2013-11-21 12:16:28 +0100 | [diff] [blame] | 767 | strError = "Element not found: " + strPath; |
| Frederic Boisnard | 6cae0ec | 2013-05-23 18:48:58 +0200 | [diff] [blame] | 768 | return NULL; |
| 769 | } |
| 770 | |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 771 | if (!pConfigurableElement->isParameter()) { |
| 772 | |
| 773 | // Element is not parameter |
| Kevin Rocard | 4c3f8d8 | 2013-11-21 12:16:28 +0100 | [diff] [blame] | 774 | strError = "Not a parameter: " + strPath; |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 775 | |
| Patrick Benavoli | 79f16cc | 2011-11-25 22:36:41 +0100 | [diff] [blame] | 776 | return NULL; |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 777 | } |
| 778 | |
| 779 | // Convert as parameter and return new handle |
| Frederic Boisnard | 6cae0ec | 2013-05-23 18:48:58 +0200 | [diff] [blame] | 780 | return new CParameterHandle(static_cast<const CBaseParameter*>(pConfigurableElement), this); |
| Patrick Benavoli | 4bed921 | 2011-10-27 14:18:00 +0200 | [diff] [blame] | 781 | } |
| 782 | |
| Kevin Rocard | ecf9310 | 2013-07-10 18:28:10 +0200 | [diff] [blame] | 783 | void CParameterMgr::setFailureOnMissingSubsystem(bool bFail) |
| 784 | { |
| 785 | _bFailOnMissingSubsystem = bFail; |
| 786 | } |
| 787 | |
| 788 | bool CParameterMgr::getFailureOnMissingSubsystem() const |
| 789 | { |
| 790 | return _bFailOnMissingSubsystem; |
| 791 | } |
| Kevin Rocard | d6909eb | 2013-07-18 09:13:51 +0200 | [diff] [blame] | 792 | |
| 793 | void CParameterMgr::setFailureOnFailedSettingsLoad(bool bFail) |
| 794 | { |
| 795 | _bFailOnFailedSettingsLoad = bFail; |
| 796 | } |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 797 | |
| Kevin Rocard | d6909eb | 2013-07-18 09:13:51 +0200 | [diff] [blame] | 798 | bool CParameterMgr::getFailureOnFailedSettingsLoad() |
| 799 | { |
| 800 | return _bFailOnFailedSettingsLoad; |
| 801 | } |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 802 | |
| 803 | void CParameterMgr::setValidateSchemasOnStart(bool bValidate) |
| 804 | { |
| 805 | _bValidateSchemasOnStart = bValidate; |
| 806 | } |
| 807 | |
| 808 | bool CParameterMgr::getValidateSchemasOnStart() const |
| 809 | { |
| 810 | return _bValidateSchemasOnStart; |
| 811 | } |
| 812 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 813 | /////////////////// Remote command parsers |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 814 | /// Version |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 815 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::versionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 816 | { |
| 817 | (void)remoteCommand; |
| 818 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 819 | // Show version |
| 820 | strResult = getVersion(); |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 821 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 822 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 823 | } |
| 824 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 825 | /// Status |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 826 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::statusCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 827 | { |
| 828 | (void)remoteCommand; |
| 829 | // System class |
| 830 | const CSystemClass* pSystemClass = getSystemClass(); |
| 831 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 832 | // Show status |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 833 | /// General section |
| 834 | appendTitle(strResult, "General:"); |
| 835 | // System class |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 836 | strResult += "System Class: "; |
| 837 | strResult += pSystemClass->getName(); |
| 838 | strResult += "\n"; |
| 839 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 840 | // Tuning mode |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 841 | strResult += "Tuning Mode: "; |
| 842 | strResult += tuningModeOn() ? "on" : "off"; |
| 843 | strResult += "\n"; |
| 844 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 845 | // Value space |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 846 | strResult += "Value Space: "; |
| 847 | strResult += valueSpaceIsRaw() ? "raw" : "real"; |
| 848 | strResult += "\n"; |
| 849 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 850 | // Output raw format |
| 851 | strResult += "Output Raw Format: "; |
| 852 | strResult += outputRawFormatIsHex() ? "hex" : "dec"; |
| 853 | strResult += "\n"; |
| 854 | |
| 855 | // Auto Sync |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 856 | strResult += "Auto Sync: "; |
| 857 | strResult += autoSyncOn() ? "on" : "off"; |
| 858 | strResult += "\n"; |
| 859 | |
| 860 | /// Subsystem list |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 861 | appendTitle(strResult, "Subsystems:"); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 862 | string strSubsystemList; |
| 863 | pSystemClass->listChildrenPaths(strSubsystemList); |
| 864 | strResult += strSubsystemList; |
| 865 | |
| 866 | /// Last applied configurations |
| Frédéric Boisnard | 8b243f5 | 2012-09-06 18:03:20 +0200 | [diff] [blame] | 867 | appendTitle(strResult, "Last Applied [Pending] Configurations:"); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 868 | string strLastAppliedConfigurations; |
| 869 | getConfigurableDomains()->listLastAppliedConfigurations(strLastAppliedConfigurations); |
| 870 | strResult += strLastAppliedConfigurations; |
| 871 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 872 | /// Criteria states |
| Frédéric Boisnard | 8b243f5 | 2012-09-06 18:03:20 +0200 | [diff] [blame] | 873 | appendTitle(strResult, "Selection Criteria:"); |
| Kevin Rocard | 7f26582 | 2012-12-07 18:51:22 +0100 | [diff] [blame] | 874 | list<string> lstrSelectionCriteria; |
| 875 | getSelectionCriteria()->listSelectionCriteria(lstrSelectionCriteria, false, true); |
| 876 | // Concatenate the criterion list as the command result |
| Frederic Boisnard | 390b36d | 2013-05-23 15:28:31 +0200 | [diff] [blame] | 877 | string strCriteriaStates; |
| 878 | CUtility::asString(lstrSelectionCriteria, strCriteriaStates); |
| 879 | strResult += strCriteriaStates; |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 880 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 881 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 882 | } |
| 883 | |
| 884 | /// Tuning Mode |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 885 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 886 | { |
| 887 | if (remoteCommand.getArgument(0) == "on") { |
| 888 | |
| 889 | if (setTuningMode(true, strResult)) { |
| 890 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 891 | return CCommandHandler::EDone; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 892 | } |
| 893 | } else if (remoteCommand.getArgument(0) == "off") { |
| 894 | |
| 895 | if (setTuningMode(false, strResult)) { |
| 896 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 897 | return CCommandHandler::EDone; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 898 | } |
| 899 | } else { |
| 900 | // Show usage |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 901 | return CCommandHandler::EShowUsage; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 902 | } |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 903 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 904 | } |
| 905 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 906 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 907 | { |
| 908 | (void)remoteCommand; |
| 909 | |
| 910 | strResult = tuningModeOn() ? "on" : "off"; |
| 911 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 912 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 913 | } |
| 914 | |
| 915 | /// Value Space |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 916 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 917 | { |
| 918 | (void)strResult; |
| 919 | |
| 920 | if (remoteCommand.getArgument(0) == "raw") { |
| 921 | |
| 922 | setValueSpace(true); |
| 923 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 924 | return CCommandHandler::EDone; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 925 | |
| 926 | } else if (remoteCommand.getArgument(0) == "real") { |
| 927 | |
| 928 | setValueSpace(false); |
| 929 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 930 | return CCommandHandler::EDone; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 931 | |
| 932 | } else { |
| 933 | // Show usage |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 934 | return CCommandHandler::EShowUsage; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 935 | } |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 936 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 937 | } |
| 938 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 939 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 940 | { |
| 941 | (void)remoteCommand; |
| 942 | |
| 943 | strResult = valueSpaceIsRaw() ? "raw" : "real"; |
| 944 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 945 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 946 | } |
| 947 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 948 | /// Output Raw Format |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 949 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 950 | { |
| 951 | (void)strResult; |
| 952 | |
| 953 | if (remoteCommand.getArgument(0) == "hex") { |
| 954 | |
| 955 | setOutputRawFormat(true); |
| 956 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 957 | return CCommandHandler::EDone; |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 958 | |
| 959 | } else if (remoteCommand.getArgument(0) == "dec") { |
| 960 | |
| 961 | setOutputRawFormat(false); |
| 962 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 963 | return CCommandHandler::EDone; |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 964 | |
| 965 | } else { |
| 966 | // Show usage |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 967 | return CCommandHandler::EShowUsage; |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 968 | } |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 969 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 970 | } |
| 971 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 972 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 973 | { |
| 974 | (void)remoteCommand; |
| 975 | |
| 976 | strResult = outputRawFormatIsHex() ? "hex" : "dec"; |
| 977 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 978 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 979 | } |
| 980 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 981 | /// Sync |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 982 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 983 | { |
| 984 | if (remoteCommand.getArgument(0) == "on") { |
| 985 | |
| 986 | if (setAutoSync(true, strResult)) { |
| 987 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 988 | return CCommandHandler::EDone; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 989 | } |
| 990 | } else if (remoteCommand.getArgument(0) == "off") { |
| 991 | |
| 992 | if (setAutoSync(false, strResult)) { |
| 993 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 994 | return CCommandHandler::EDone; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 995 | } |
| 996 | } else { |
| 997 | // Show usage |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 998 | return CCommandHandler::EShowUsage; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 999 | } |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1000 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1001 | } |
| 1002 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1003 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1004 | { |
| 1005 | (void)remoteCommand; |
| 1006 | |
| 1007 | strResult = autoSyncOn() ? "on" : "off"; |
| 1008 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1009 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1010 | } |
| 1011 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1012 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::syncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1013 | { |
| 1014 | (void)remoteCommand; |
| 1015 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1016 | return sync(strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1017 | } |
| 1018 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1019 | /// Criteria |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1020 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listCriteriaCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1021 | { |
| 1022 | (void)remoteCommand; |
| 1023 | |
| Kevin Rocard | 4eae827 | 2013-04-18 19:12:46 +0200 | [diff] [blame] | 1024 | bool humanReadable = true; |
| Kevin Rocard | 7f26582 | 2012-12-07 18:51:22 +0100 | [diff] [blame] | 1025 | |
| Kevin Rocard | 4eae827 | 2013-04-18 19:12:46 +0200 | [diff] [blame] | 1026 | // Look for optional arguments |
| 1027 | if (remoteCommand.getArgumentCount() >= 1) { |
| 1028 | |
| 1029 | // If csv is provided, format the criterion list in Commas Separated Value pairs |
| 1030 | if (remoteCommand.getArgument(0) == "csv") { |
| 1031 | humanReadable = false; |
| 1032 | } else { |
| 1033 | return CCommandHandler::EShowUsage; |
| 1034 | } |
| 1035 | } |
| 1036 | |
| 1037 | list<string> lstrResult; |
| 1038 | getSelectionCriteria()->listSelectionCriteria(lstrResult, true, humanReadable); |
| Kevin Rocard | 7f26582 | 2012-12-07 18:51:22 +0100 | [diff] [blame] | 1039 | |
| 1040 | // Concatenate the criterion list as the command result |
| Frederic Boisnard | 390b36d | 2013-05-23 15:28:31 +0200 | [diff] [blame] | 1041 | CUtility::asString(lstrResult, strResult); |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1042 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1043 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1044 | } |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1045 | |
| 1046 | /// Domains |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1047 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1048 | { |
| 1049 | (void)remoteCommand; |
| 1050 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1051 | getConfigurableDomains()->listDomains(strResult); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1052 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1053 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1054 | } |
| 1055 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1056 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1057 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1058 | return createDomain(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1059 | } |
| 1060 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1061 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1062 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1063 | return deleteDomain(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1064 | } |
| 1065 | |
| Kevin Rocard | 170f0a4 | 2012-06-18 13:56:05 +0200 | [diff] [blame] | 1066 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteAllDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1067 | { |
| 1068 | (void)remoteCommand; |
| 1069 | |
| 1070 | return deleteAllDomains(strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| 1071 | } |
| 1072 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1073 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1074 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1075 | 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] | 1076 | } |
| 1077 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1078 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1079 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1080 | // Check tuning mode |
| 1081 | if (!checkTuningModeOn(strResult)) { |
| 1082 | |
| 1083 | return CCommandHandler::EFailed; |
| 1084 | } |
| 1085 | |
| 1086 | // Set property |
| 1087 | bool bSequenceAware; |
| 1088 | |
| 1089 | if (remoteCommand.getArgument(1) == "true") { |
| 1090 | |
| 1091 | bSequenceAware = true; |
| 1092 | |
| 1093 | } else if (remoteCommand.getArgument(1) == "false") { |
| 1094 | |
| 1095 | bSequenceAware = false; |
| 1096 | |
| 1097 | } else { |
| 1098 | // Show usage |
| 1099 | return CCommandHandler::EShowUsage; |
| 1100 | } |
| 1101 | |
| 1102 | return getConfigurableDomains()->setSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1103 | } |
| 1104 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1105 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1106 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1107 | // Get property |
| 1108 | bool bSequenceAware; |
| 1109 | |
| 1110 | if (!getConfigurableDomains()->getSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult)) { |
| 1111 | |
| 1112 | return CCommandHandler::EFailed; |
| 1113 | } |
| 1114 | |
| 1115 | strResult = bSequenceAware ? "true" : "false"; |
| 1116 | |
| 1117 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1118 | } |
| 1119 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1120 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1121 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1122 | return getConfigurableDomains()->listDomainElements(remoteCommand.getArgument(0), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1123 | } |
| 1124 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1125 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::addElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1126 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1127 | return addConfigurableElementToDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| 1128 | } |
| 1129 | |
| 1130 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::removeElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1131 | { |
| 1132 | return removeConfigurableElementFromDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| 1133 | } |
| 1134 | |
| 1135 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::splitDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1136 | { |
| 1137 | 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] | 1138 | } |
| 1139 | |
| 1140 | /// Configurations |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1141 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConfigurationsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1142 | { |
| Patrick Benavoli | 0bd5054 | 2011-11-29 11:10:27 +0100 | [diff] [blame] | 1143 | return getConstConfigurableDomains()->listConfigurations(remoteCommand.getArgument(0), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed; |
| 1144 | } |
| 1145 | |
| 1146 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1147 | { |
| 1148 | (void)remoteCommand; |
| 1149 | |
| 1150 | // Dummy error context |
| 1151 | string strError; |
| 1152 | CErrorContext errorContext(strError); |
| 1153 | |
| 1154 | // Dump |
| 1155 | getConstConfigurableDomains()->dumpContent(strResult, errorContext); |
| 1156 | |
| 1157 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1158 | } |
| 1159 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1160 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1161 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1162 | 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] | 1163 | } |
| 1164 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1165 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1166 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1167 | 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] | 1168 | } |
| 1169 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1170 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1171 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1172 | 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] | 1173 | } |
| 1174 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1175 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::saveConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1176 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1177 | 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] | 1178 | } |
| 1179 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1180 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::restoreConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1181 | { |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 1182 | list<string> lstrResult; |
| 1183 | if (!restoreConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), lstrResult)) { |
| 1184 | //Concatenate the error list as the command result |
| Frederic Boisnard | 390b36d | 2013-05-23 15:28:31 +0200 | [diff] [blame] | 1185 | CUtility::asString(lstrResult, strResult); |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 1186 | |
| 1187 | return CCommandHandler::EFailed; |
| 1188 | } |
| 1189 | return CCommandHandler::EDone; |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1190 | } |
| 1191 | |
| 1192 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1193 | { |
| 1194 | // Check tuning mode |
| 1195 | if (!checkTuningModeOn(strResult)) { |
| 1196 | |
| 1197 | return CCommandHandler::EFailed; |
| 1198 | } |
| 1199 | |
| 1200 | // Build configurable element path list |
| Sebastien Gonzalve | d952649 | 2014-02-20 22:28:03 +0100 | [diff] [blame] | 1201 | std::vector<string> astrNewElementSequence; |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1202 | |
| 1203 | uint32_t uiArgument; |
| 1204 | |
| 1205 | for (uiArgument = 2; uiArgument < remoteCommand.getArgumentCount(); uiArgument++) { |
| 1206 | |
| 1207 | astrNewElementSequence.push_back(remoteCommand.getArgument(uiArgument)); |
| 1208 | } |
| 1209 | |
| 1210 | // Delegate to configurable domains |
| 1211 | return getConfigurableDomains()->setElementSequence(remoteCommand.getArgument(0), remoteCommand.getArgument(1), astrNewElementSequence, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| 1212 | } |
| 1213 | |
| 1214 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1215 | { |
| 1216 | // Delegate to configurable domains |
| 1217 | 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] | 1218 | } |
| 1219 | |
| Patrick Benavoli | 0bd5054 | 2011-11-29 11:10:27 +0100 | [diff] [blame] | 1220 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1221 | { |
| 1222 | // Delegate to configurable domains |
| 1223 | return getConfigurableDomains()->setApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), remoteCommand.packArguments(2, remoteCommand.getArgumentCount() - 2), getConstSelectionCriteria()->getSelectionCriteriaDefinition(), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| 1224 | } |
| 1225 | |
| 1226 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::clearRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1227 | { |
| 1228 | // Delegate to configurable domains |
| 1229 | return getConfigurableDomains()->clearApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| 1230 | } |
| 1231 | |
| 1232 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1233 | { |
| 1234 | // Delegate to configurable domains |
| 1235 | return getConfigurableDomains()->getApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed; |
| 1236 | } |
| 1237 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1238 | /// Elements/Parameters |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1239 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1240 | { |
| 1241 | CElementLocator elementLocator(getSystemClass(), false); |
| 1242 | |
| 1243 | CElement* pLocatedElement = NULL; |
| 1244 | |
| 1245 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1246 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1247 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1248 | } |
| 1249 | |
| 1250 | strResult = string("\n"); |
| 1251 | |
| 1252 | if (!pLocatedElement) { |
| 1253 | |
| 1254 | // List from root folder |
| 1255 | |
| 1256 | // Return system class qualified name |
| 1257 | pLocatedElement = getSystemClass(); |
| 1258 | } |
| 1259 | |
| 1260 | // Return sub-elements |
| 1261 | strResult += pLocatedElement->listQualifiedPaths(false); |
| 1262 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1263 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1264 | } |
| 1265 | |
| 1266 | /// Elements/Parameters |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1267 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listParametersCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1268 | { |
| 1269 | CElementLocator elementLocator(getSystemClass(), false); |
| 1270 | |
| 1271 | CElement* pLocatedElement = NULL; |
| 1272 | |
| 1273 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1274 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1275 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1276 | } |
| 1277 | |
| 1278 | strResult = string("\n"); |
| 1279 | |
| 1280 | if (!pLocatedElement) { |
| 1281 | |
| 1282 | // List from root folder |
| 1283 | |
| 1284 | // Return system class qualified name |
| 1285 | pLocatedElement = getSystemClass(); |
| 1286 | } |
| 1287 | |
| 1288 | // Return sub-elements |
| 1289 | strResult += pLocatedElement->listQualifiedPaths(true); |
| 1290 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1291 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1292 | } |
| 1293 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1294 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1295 | { |
| 1296 | CElementLocator elementLocator(getSystemClass()); |
| 1297 | |
| 1298 | CElement* pLocatedElement = NULL; |
| 1299 | |
| 1300 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1301 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1302 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1303 | } |
| 1304 | |
| 1305 | string strError; |
| 1306 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1307 | CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1308 | |
| 1309 | // Dump elements |
| 1310 | pLocatedElement->dumpContent(strResult, parameterAccessContext); |
| 1311 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1312 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1313 | } |
| 1314 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1315 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSizeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1316 | { |
| 1317 | CElementLocator elementLocator(getSystemClass()); |
| 1318 | |
| 1319 | CElement* pLocatedElement = NULL; |
| 1320 | |
| 1321 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1322 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1323 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1324 | } |
| 1325 | |
| 1326 | // Converted to actual sizable element |
| 1327 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1328 | |
| 1329 | // Get size as string |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1330 | strResult = pConfigurableElement->getFootprintAsString(); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1331 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1332 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1333 | } |
| 1334 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1335 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showPropertiesCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 2ecf900 | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1336 | { |
| 1337 | CElementLocator elementLocator(getSystemClass()); |
| 1338 | |
| 1339 | CElement* pLocatedElement = NULL; |
| 1340 | |
| 1341 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1342 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1343 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 2ecf900 | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1344 | } |
| 1345 | |
| 1346 | // Convert element |
| 1347 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1348 | |
| 1349 | // Return element properties |
| 1350 | pConfigurableElement->showProperties(strResult); |
| 1351 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1352 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 2ecf900 | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1353 | } |
| 1354 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1355 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1356 | { |
| 1357 | string strValue; |
| 1358 | |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1359 | if (!accessParameterValue(remoteCommand.getArgument(0), strValue, false, strResult)) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1360 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1361 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1362 | } |
| 1363 | // Succeeded |
| 1364 | strResult = strValue; |
| 1365 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1366 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1367 | } |
| 1368 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1369 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1370 | { |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 1371 | // Check tuning mode |
| 1372 | if (!checkTuningModeOn(strResult)) { |
| 1373 | |
| 1374 | return CCommandHandler::EFailed; |
| 1375 | } |
| 1376 | // Get value to set |
| 1377 | string strValue = remoteCommand.packArguments(1, remoteCommand.getArgumentCount() - 1); |
| 1378 | |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1379 | return accessParameterValue(remoteCommand.getArgument(0), strValue, true, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1380 | } |
| 1381 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1382 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listBelongingDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1383 | { |
| 1384 | CElementLocator elementLocator(getSystemClass()); |
| 1385 | |
| 1386 | CElement* pLocatedElement = NULL; |
| 1387 | |
| 1388 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1389 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1390 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1391 | } |
| 1392 | |
| 1393 | // Convert element |
| 1394 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1395 | |
| 1396 | // Return element belonging domains |
| 1397 | pConfigurableElement->listBelongingDomains(strResult); |
| 1398 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1399 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1400 | } |
| 1401 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1402 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1403 | { |
| 1404 | CElementLocator elementLocator(getSystemClass()); |
| 1405 | |
| 1406 | CElement* pLocatedElement = NULL; |
| 1407 | |
| 1408 | if (!elementLocator.locate(remoteCommand.getArgument(0), &pLocatedElement, strResult)) { |
| 1409 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1410 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1411 | } |
| 1412 | |
| 1413 | // Convert element |
| 1414 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1415 | |
| 1416 | // Return element belonging domains |
| 1417 | pConfigurableElement->listAssociatedDomains(strResult); |
| 1418 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1419 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1420 | } |
| 1421 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1422 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1423 | { |
| 1424 | (void)remoteCommand; |
| 1425 | |
| 1426 | getConfigurableDomains()->listAssociatedElements(strResult); |
| 1427 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1428 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1429 | } |
| 1430 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1431 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConflictingElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1432 | { |
| 1433 | (void)remoteCommand; |
| 1434 | |
| 1435 | getConfigurableDomains()->listConflictingElements(strResult); |
| 1436 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1437 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1438 | } |
| 1439 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1440 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listRogueElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1441 | { |
| 1442 | (void)remoteCommand; |
| 1443 | |
| 1444 | getSystemClass()->listRogueElements(strResult); |
| 1445 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1446 | return CCommandHandler::ESucceeded; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1447 | } |
| 1448 | |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1449 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1450 | { |
| 1451 | string strOutputValue; |
| 1452 | string strError; |
| 1453 | |
| 1454 | if (!accessConfigurationValue(remoteCommand.getArgument(0), remoteCommand.getArgument(1), remoteCommand.getArgument(2), strOutputValue, false, strError)) { |
| 1455 | |
| 1456 | strResult = strError; |
| 1457 | return CCommandHandler::EFailed; |
| 1458 | } |
| 1459 | // Succeeded |
| 1460 | strResult = strOutputValue; |
| 1461 | |
| 1462 | return CCommandHandler::ESucceeded; |
| 1463 | } |
| 1464 | |
| 1465 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| 1466 | { |
| 1467 | // Get value to set |
| 1468 | string strValue = remoteCommand.packArguments(3, remoteCommand.getArgumentCount() - 3); |
| 1469 | |
| 1470 | bool bSuccess = accessConfigurationValue(remoteCommand.getArgument(0), |
| 1471 | remoteCommand.getArgument(1), |
| 1472 | remoteCommand.getArgument(2), |
| 1473 | strValue, true, strResult); |
| 1474 | |
| 1475 | return bSuccess ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| 1476 | } |
| 1477 | |
| Frederic Boisnard | 6cae0ec | 2013-05-23 18:48:58 +0200 | [diff] [blame] | 1478 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showMappingCommmandProcess( |
| 1479 | const IRemoteCommand& remoteCommand, |
| 1480 | string& strResult) |
| 1481 | { |
| 1482 | if (!getParameterMapping(remoteCommand.getArgument(0), strResult)) { |
| 1483 | |
| 1484 | return CCommandHandler::EFailed; |
| 1485 | } |
| 1486 | |
| 1487 | return CCommandHandler::ESucceeded; |
| 1488 | } |
| 1489 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1490 | /// Settings Import/Export |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1491 | CParameterMgr::CCommandHandler::CommandStatus |
| 1492 | CParameterMgr::exportConfigurableDomainsToXMLCommmandProcess( |
| 1493 | const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1494 | { |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1495 | string strFileName = remoteCommand.getArgument(0); |
| 1496 | return exportDomainsXml(strFileName, false, true, strResult) ? |
| 1497 | CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1498 | } |
| 1499 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1500 | CParameterMgr::CCommandHandler::CommandStatus |
| 1501 | CParameterMgr::importConfigurableDomainsFromXMLCommmandProcess( |
| 1502 | const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1503 | { |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1504 | return importDomainsXml(remoteCommand.getArgument(0), false, true, strResult) ? |
| 1505 | CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1506 | } |
| 1507 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1508 | CParameterMgr::CCommandHandler::CommandStatus |
| 1509 | CParameterMgr::exportConfigurableDomainsWithSettingsToXMLCommmandProcess( |
| 1510 | const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1511 | { |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1512 | string strFileName = remoteCommand.getArgument(0); |
| 1513 | return exportDomainsXml(strFileName, true, true, strResult) ? |
| 1514 | CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1515 | } |
| 1516 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1517 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1518 | { |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1519 | return importDomainsXml(remoteCommand.getArgument(0), true, true, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1520 | } |
| 1521 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1522 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1523 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1524 | return exportDomainsBinary(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1525 | } |
| 1526 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1527 | CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1528 | { |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1529 | return importDomainsBinary(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1530 | } |
| 1531 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1532 | CParameterMgr::CCommandHandler::CommandStatus |
| 1533 | CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess( |
| 1534 | const IRemoteCommand& remoteCommand, string& strResult) |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 1535 | { |
| 1536 | (void)remoteCommand; |
| 1537 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1538 | if (!exportDomainsXml(strResult, true, false, strResult)) { |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 1539 | |
| 1540 | return CCommandHandler::EFailed; |
| 1541 | } |
| 1542 | // Succeeded |
| 1543 | return CCommandHandler::ESucceeded; |
| 1544 | } |
| 1545 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1546 | CParameterMgr::CCommandHandler::CommandStatus |
| David Wagner | ed744eb | 2014-12-04 18:38:52 +0100 | [diff] [blame^] | 1547 | CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess( |
| 1548 | const IRemoteCommand& remoteCommand, string& strResult) |
| 1549 | { |
| 1550 | string strDomainName = remoteCommand.getArgument(0); |
| 1551 | |
| 1552 | return exportSingleDomainXml(strResult, strDomainName, true, false, strResult) ? |
| 1553 | CCommandHandler::ESucceeded : CCommandHandler::EFailed; |
| 1554 | } |
| 1555 | |
| 1556 | CParameterMgr::CCommandHandler::CommandStatus |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 1557 | CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess( |
| 1558 | const IRemoteCommand& remoteCommand, string& strResult) |
| 1559 | { |
| 1560 | return importDomainsXml(remoteCommand.getArgument(0), true, false, strResult) ? |
| 1561 | CCommandHandler::EDone : CCommandHandler::EFailed; |
| 1562 | } |
| 1563 | |
| 1564 | CParameterMgr::CCommandHandler::CommandStatus |
| 1565 | CParameterMgr::getSystemClassXMLCommmandProcess( |
| 1566 | const IRemoteCommand& remoteCommand, string& strResult) |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 1567 | { |
| 1568 | (void)remoteCommand; |
| 1569 | |
| 1570 | if (!getSystemClassXMLString(strResult)) { |
| 1571 | |
| 1572 | return CCommandHandler::EFailed; |
| 1573 | } |
| 1574 | // Succeeded |
| 1575 | return CCommandHandler::ESucceeded; |
| 1576 | } |
| 1577 | |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1578 | // User set/get parameters in main BlackBoard |
| 1579 | bool CParameterMgr::accessParameterValue(const string& strPath, string& strValue, bool bSet, string& strError) |
| 1580 | { |
| 1581 | // Define context |
| 1582 | CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex); |
| 1583 | |
| Frédéric Boisnard | 150407c | 2013-03-15 14:46:23 +0100 | [diff] [blame] | 1584 | // Activate the auto synchronization with the hardware |
| 1585 | if (bSet) { |
| 1586 | |
| 1587 | parameterAccessContext.setAutoSync(_bAutoSyncOn); |
| 1588 | } |
| 1589 | |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1590 | return accessValue(parameterAccessContext, strPath, strValue, bSet, strError); |
| 1591 | } |
| 1592 | |
| Frederic Boisnard | 6cae0ec | 2013-05-23 18:48:58 +0200 | [diff] [blame] | 1593 | // User get parameter mapping |
| 1594 | bool CParameterMgr::getParameterMapping(const string& strPath, string& strResult) const |
| 1595 | { |
| 1596 | CPathNavigator pathNavigator(strPath); |
| 1597 | |
| 1598 | // Nagivate through system class |
| 1599 | if (!pathNavigator.navigateThrough(getConstSystemClass()->getName(), strResult)) { |
| 1600 | |
| 1601 | return false; |
| 1602 | } |
| 1603 | |
| 1604 | // Get the ConfigurableElement corresponding to strPath |
| 1605 | const CConfigurableElement* pConfigurableElement = getConfigurableElement(strPath, strResult); |
| 1606 | if (!pConfigurableElement) { |
| 1607 | |
| 1608 | return false; |
| 1609 | } |
| 1610 | |
| 1611 | // Find the list of the ancestors of the current ConfigurableElement that have a mapping |
| 1612 | list<const CConfigurableElement*> configurableElementPath; |
| 1613 | pConfigurableElement->getListOfElementsWithMapping(configurableElementPath); |
| 1614 | |
| 1615 | // Get the Subsystem containing the ConfigurableElement |
| 1616 | const CSubsystem* pSubsystem = pConfigurableElement->getBelongingSubsystem(); |
| 1617 | if (!pSubsystem) { |
| 1618 | |
| 1619 | strResult = "Unable to find the Subsystem containing the parameter"; |
| 1620 | return false; |
| 1621 | } |
| 1622 | |
| 1623 | // Fetch the mapping corresponding to the ConfigurableElement |
| 1624 | strResult = pSubsystem->getMapping(configurableElementPath); |
| 1625 | |
| 1626 | return true; |
| 1627 | } |
| 1628 | |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1629 | // User set/get parameters in specific Configuration BlackBoard |
| 1630 | bool CParameterMgr::accessConfigurationValue(const string& strDomain, const string& strConfiguration, const string& strPath, string& strValue, bool bSet, string& strError) |
| 1631 | { |
| 1632 | CElementLocator elementLocator(getSystemClass()); |
| 1633 | |
| 1634 | CElement* pLocatedElement = NULL; |
| 1635 | |
| 1636 | if (!elementLocator.locate(strPath, &pLocatedElement, strError)) { |
| 1637 | |
| 1638 | return false; |
| 1639 | } |
| 1640 | |
| 1641 | // Convert element |
| 1642 | const CConfigurableElement* pConfigurableElement = static_cast<const CConfigurableElement*>(pLocatedElement); |
| 1643 | |
| 1644 | // Get the Configuration blackboard and the Base Offset of the configurable element in this blackboard |
| 1645 | uint32_t uiBaseOffset; |
| 1646 | bool bIsLastApplied; |
| 1647 | |
| 1648 | CParameterBlackboard* pConfigurationBlackboard = getConstConfigurableDomains()->findConfigurationBlackboard(strDomain, strConfiguration, pConfigurableElement, uiBaseOffset, bIsLastApplied, strError); |
| 1649 | |
| 1650 | if (!pConfigurationBlackboard) { |
| 1651 | |
| 1652 | return false; |
| 1653 | } |
| 1654 | |
| 1655 | log_info("Element %s in Domain %s, offset: %d, base offset: %d", strPath.c_str(), strDomain.c_str(), pConfigurableElement->getOffset(), uiBaseOffset); |
| 1656 | |
| 1657 | /// Update the Configuration Blackboard |
| 1658 | |
| Frédéric Boisnard | 150407c | 2013-03-15 14:46:23 +0100 | [diff] [blame] | 1659 | // Define Configuration context using Base Offset and keep Auto Sync off to prevent access to HW |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1660 | CParameterAccessContext parameterAccessContext(strError, pConfigurationBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex, uiBaseOffset); |
| 1661 | |
| Frédéric Boisnard | da8298c | 2014-05-23 19:05:31 +0200 | [diff] [blame] | 1662 | // Deactivate the auto synchronization with the hardware during the Configuration Blackboard |
| 1663 | // access (only Main Blackboard shall be synchronized, Configurations Blackboards are copied |
| 1664 | // into the Main Blackboard each time a configuration is restored but they are not synchronized |
| 1665 | // directly). |
| 1666 | if (bSet) { |
| 1667 | |
| 1668 | parameterAccessContext.setAutoSync(false); |
| 1669 | } |
| 1670 | |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1671 | // Access Value in the Configuration Blackboard |
| 1672 | if (!accessValue(parameterAccessContext, strPath, strValue, bSet, strError)) { |
| 1673 | |
| 1674 | return false; |
| 1675 | } |
| 1676 | |
| 1677 | /// If the Configuration is the last one applied, update the Main Blackboard as well |
| 1678 | |
| 1679 | if (bIsLastApplied) { |
| 1680 | |
| 1681 | // Define Main context |
| 1682 | parameterAccessContext.setParameterBlackboard(_pMainParameterBlackboard); |
| 1683 | |
| Frédéric Boisnard | 150407c | 2013-03-15 14:46:23 +0100 | [diff] [blame] | 1684 | // Activate the auto synchronization with the hardware |
| 1685 | if (bSet) { |
| 1686 | |
| 1687 | parameterAccessContext.setAutoSync(_bAutoSyncOn); |
| 1688 | } |
| 1689 | |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1690 | // Access Value in the Main Blackboard |
| 1691 | return accessValue(parameterAccessContext, strPath, strValue, bSet, strError); |
| 1692 | } |
| 1693 | |
| 1694 | return true; |
| 1695 | } |
| 1696 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1697 | // User set/get parameters |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 1698 | bool CParameterMgr::accessValue(CParameterAccessContext& parameterAccessContext, const string& strPath, string& strValue, bool bSet, string& strError) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1699 | { |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 1700 | // Lock state |
| 1701 | CAutoLock autoLock(&_blackboardMutex); |
| 1702 | |
| 1703 | CPathNavigator pathNavigator(strPath); |
| 1704 | |
| 1705 | // Nagivate through system class |
| 1706 | if (!pathNavigator.navigateThrough(getConstSystemClass()->getName(), strError)) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1707 | |
| Frederic Boisnard | 6cae0ec | 2013-05-23 18:48:58 +0200 | [diff] [blame] | 1708 | parameterAccessContext.setError(strError); |
| 1709 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1710 | return false; |
| 1711 | } |
| 1712 | |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 1713 | // Do the get |
| 1714 | return getConstSystemClass()->accessValue(pathNavigator, strValue, bSet, parameterAccessContext); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1715 | } |
| 1716 | |
| 1717 | // Tuning mode |
| 1718 | bool CParameterMgr::setTuningMode(bool bOn, string& strError) |
| 1719 | { |
| 1720 | // Tuning allowed? |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 1721 | if (bOn && !getConstFrameworkConfiguration()->isTuningAllowed()) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1722 | |
| 1723 | strError = "Tuning prohibited"; |
| 1724 | |
| 1725 | return false; |
| 1726 | } |
| 1727 | // Lock state |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 1728 | CAutoLock autoLock(&_blackboardMutex); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1729 | |
| 1730 | // Warn domains about exiting tuning mode |
| 1731 | if (!bOn && _bTuningModeIsOn) { |
| 1732 | |
| 1733 | // Ensure application of currently selected configurations |
| Patrick Benavoli | 1387bda | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1734 | // Force-apply configurations |
| Guillaume Denneulin | f2fd15a | 2012-12-20 17:53:29 +0100 | [diff] [blame] | 1735 | doApplyConfigurations(true); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1736 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1737 | // Turn auto sync back on |
| 1738 | _bAutoSyncOn = true; |
| 1739 | } |
| 1740 | |
| 1741 | // Store |
| 1742 | _bTuningModeIsOn = bOn; |
| 1743 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1744 | return true; |
| 1745 | } |
| 1746 | |
| 1747 | bool CParameterMgr::tuningModeOn() const |
| 1748 | { |
| 1749 | return _bTuningModeIsOn; |
| 1750 | } |
| 1751 | |
| 1752 | // Current value space for user set/get value interpretation |
| 1753 | void CParameterMgr::setValueSpace(bool bIsRaw) |
| 1754 | { |
| 1755 | _bValueSpaceIsRaw = bIsRaw; |
| 1756 | } |
| 1757 | |
| 1758 | bool CParameterMgr::valueSpaceIsRaw() |
| 1759 | { |
| 1760 | return _bValueSpaceIsRaw; |
| 1761 | } |
| 1762 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1763 | // Current Output Raw Format for user get value interpretation |
| 1764 | void CParameterMgr::setOutputRawFormat(bool bIsHex) |
| 1765 | { |
| 1766 | _bOutputRawFormatIsHex = bIsHex; |
| 1767 | } |
| 1768 | |
| 1769 | bool CParameterMgr::outputRawFormatIsHex() |
| 1770 | { |
| 1771 | return _bOutputRawFormatIsHex; |
| 1772 | } |
| 1773 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1774 | /// Sync |
| 1775 | // Automatic hardware synchronization control (during tuning session) |
| 1776 | bool CParameterMgr::setAutoSync(bool bAutoSyncOn, string& strError) |
| 1777 | { |
| 1778 | // Check tuning mode |
| 1779 | if (!checkTuningModeOn(strError)) { |
| 1780 | |
| 1781 | return false; |
| 1782 | } |
| 1783 | // Warn domains about turning auto sync back on |
| 1784 | if (bAutoSyncOn && !_bAutoSyncOn) { |
| 1785 | |
| Patrick Benavoli | 592ae56 | 2011-09-05 16:53:58 +0200 | [diff] [blame] | 1786 | // Do the synchronization at system class level (could be optimized by keeping track of all modified parameters) |
| 1787 | if (!sync(strError)) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1788 | |
| 1789 | return false; |
| 1790 | } |
| 1791 | } |
| 1792 | |
| 1793 | // Set Auto sync |
| 1794 | _bAutoSyncOn = bAutoSyncOn; |
| 1795 | |
| 1796 | return true; |
| 1797 | } |
| 1798 | |
| 1799 | bool CParameterMgr::autoSyncOn() const |
| 1800 | { |
| 1801 | return _bAutoSyncOn; |
| 1802 | } |
| 1803 | |
| 1804 | // Manual hardware synchronization control (during tuning session) |
| 1805 | bool CParameterMgr::sync(string& strError) |
| 1806 | { |
| 1807 | // Check tuning mode |
| 1808 | if (!checkTuningModeOn(strError)) { |
| 1809 | |
| 1810 | return false; |
| 1811 | } |
| 1812 | // Warn domains about turning auto sync back on |
| 1813 | if (_bAutoSyncOn) { |
| 1814 | |
| 1815 | strError = "Feature unavailable when Auto Sync is on"; |
| 1816 | |
| 1817 | return false; |
| 1818 | } |
| 1819 | |
| 1820 | // Get syncer set |
| 1821 | CSyncerSet syncerSet; |
| 1822 | // ... from system class |
| 1823 | getConstSystemClass()->fillSyncerSet(syncerSet); |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 1824 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1825 | // Sync |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 1826 | list<string> lstrError; |
| 1827 | if (! syncerSet.sync(*_pMainParameterBlackboard, false, &lstrError)){ |
| 1828 | |
| Frederic Boisnard | 390b36d | 2013-05-23 15:28:31 +0200 | [diff] [blame] | 1829 | CUtility::asString(lstrError, strError); |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 1830 | return false; |
| 1831 | }; |
| 1832 | |
| 1833 | return true; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1834 | } |
| 1835 | |
| 1836 | // Content dump |
| 1837 | void CParameterMgr::logStructureContent(string& strContent) const |
| 1838 | { |
| 1839 | string strError; |
| 1840 | |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 1841 | CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1842 | |
| 1843 | dumpContent(strContent, parameterAccessContext); |
| 1844 | } |
| 1845 | |
| 1846 | // Configuration/Domains handling |
| 1847 | bool CParameterMgr::createDomain(const string& strName, string& strError) |
| 1848 | { |
| 1849 | // Check tuning mode |
| 1850 | if (!checkTuningModeOn(strError)) { |
| 1851 | |
| 1852 | return false; |
| 1853 | } |
| 1854 | |
| 1855 | // Delegate to configurable domains |
| 1856 | return getConfigurableDomains()->createDomain(strName, strError); |
| 1857 | } |
| 1858 | |
| 1859 | bool CParameterMgr::deleteDomain(const string& strName, string& strError) |
| 1860 | { |
| 1861 | // Check tuning mode |
| 1862 | if (!checkTuningModeOn(strError)) { |
| 1863 | |
| 1864 | return false; |
| 1865 | } |
| 1866 | |
| 1867 | // Delegate to configurable domains |
| 1868 | return getConfigurableDomains()->deleteDomain(strName, strError); |
| 1869 | } |
| 1870 | |
| Kevin Rocard | 170f0a4 | 2012-06-18 13:56:05 +0200 | [diff] [blame] | 1871 | bool CParameterMgr::deleteAllDomains(string& strError) |
| 1872 | { |
| 1873 | // Check tuning mode |
| 1874 | if (!checkTuningModeOn(strError)) { |
| 1875 | |
| 1876 | return false; |
| 1877 | } |
| 1878 | |
| 1879 | // Delegate to configurable domains |
| 1880 | getConfigurableDomains()->deleteAllDomains(); |
| 1881 | |
| 1882 | return true; |
| 1883 | } |
| 1884 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1885 | bool CParameterMgr::createConfiguration(const string& strDomain, const string& strConfiguration, string& strError) |
| 1886 | { |
| 1887 | // Check tuning mode |
| 1888 | if (!checkTuningModeOn(strError)) { |
| 1889 | |
| 1890 | return false; |
| 1891 | } |
| 1892 | |
| 1893 | // Delegate to configurable domains |
| 1894 | return getConfigurableDomains()->createConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, strError); |
| 1895 | } |
| 1896 | |
| 1897 | bool CParameterMgr::deleteConfiguration(const string& strDomain, const string& strConfiguration, string& strError) |
| 1898 | { |
| 1899 | // Check tuning mode |
| 1900 | if (!checkTuningModeOn(strError)) { |
| 1901 | |
| 1902 | return false; |
| 1903 | } |
| 1904 | |
| 1905 | // Delegate to configurable domains |
| 1906 | return getConfigurableDomains()->deleteConfiguration(strDomain, strConfiguration, strError); |
| 1907 | } |
| 1908 | |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 1909 | bool CParameterMgr::restoreConfiguration(const string& strDomain, const string& strConfiguration, list<string>& lstrError) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1910 | { |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 1911 | string strError; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1912 | // Check tuning mode |
| 1913 | if (!checkTuningModeOn(strError)) { |
| 1914 | |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 1915 | lstrError.push_back(strError); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1916 | return false; |
| 1917 | } |
| 1918 | |
| 1919 | // Delegate to configurable domains |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 1920 | return getConstConfigurableDomains()->restoreConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, _bAutoSyncOn, lstrError); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1921 | } |
| 1922 | |
| 1923 | bool CParameterMgr::saveConfiguration(const string& strDomain, const string& strConfiguration, string& strError) |
| 1924 | { |
| 1925 | // Check tuning mode |
| 1926 | if (!checkTuningModeOn(strError)) { |
| 1927 | |
| 1928 | return false; |
| 1929 | } |
| 1930 | |
| 1931 | // Delegate to configurable domains |
| 1932 | return getConfigurableDomains()->saveConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, strError); |
| 1933 | } |
| 1934 | |
| 1935 | // Configurable element - domain association |
| 1936 | bool CParameterMgr::addConfigurableElementToDomain(const string& strDomain, const string& strConfigurableElementPath, string& strError) |
| 1937 | { |
| 1938 | // Check tuning mode |
| 1939 | if (!checkTuningModeOn(strError)) { |
| 1940 | |
| 1941 | return false; |
| 1942 | } |
| 1943 | |
| 1944 | CElementLocator elementLocator(getSystemClass()); |
| 1945 | |
| 1946 | CElement* pLocatedElement = NULL; |
| 1947 | |
| 1948 | if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) { |
| 1949 | |
| 1950 | return false; |
| 1951 | } |
| 1952 | |
| 1953 | // Convert element |
| Pavel Chupin | 85413ff | 2012-04-24 10:55:48 +0400 | [diff] [blame] | 1954 | CConfigurableElement* pConfigurableElement = static_cast<CConfigurableElement*>(pLocatedElement); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1955 | |
| 1956 | // Delegate |
| 1957 | return getConfigurableDomains()->addConfigurableElementToDomain(strDomain, pConfigurableElement, _pMainParameterBlackboard, strError); |
| 1958 | } |
| 1959 | |
| 1960 | bool CParameterMgr::removeConfigurableElementFromDomain(const string& strDomain, const string& strConfigurableElementPath, string& strError) |
| 1961 | { |
| 1962 | // Check tuning mode |
| 1963 | if (!checkTuningModeOn(strError)) { |
| 1964 | |
| 1965 | return false; |
| 1966 | } |
| 1967 | |
| 1968 | CElementLocator elementLocator(getSystemClass()); |
| 1969 | |
| 1970 | CElement* pLocatedElement = NULL; |
| 1971 | |
| 1972 | if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) { |
| 1973 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1974 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1975 | } |
| 1976 | |
| 1977 | // Convert element |
| Pavel Chupin | 85413ff | 2012-04-24 10:55:48 +0400 | [diff] [blame] | 1978 | CConfigurableElement* pConfigurableElement = static_cast<CConfigurableElement*>(pLocatedElement); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1979 | |
| 1980 | // Delegate |
| 1981 | return getConfigurableDomains()->removeConfigurableElementFromDomain(strDomain, pConfigurableElement, strError); |
| 1982 | } |
| 1983 | |
| 1984 | bool CParameterMgr::split(const string& strDomain, const string& strConfigurableElementPath, string& strError) |
| 1985 | { |
| 1986 | // Check tuning mode |
| 1987 | if (!checkTuningModeOn(strError)) { |
| 1988 | |
| 1989 | return false; |
| 1990 | } |
| 1991 | |
| 1992 | CElementLocator elementLocator(getSystemClass()); |
| 1993 | |
| 1994 | CElement* pLocatedElement = NULL; |
| 1995 | |
| 1996 | if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) { |
| 1997 | |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 1998 | return CCommandHandler::EFailed; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 1999 | } |
| 2000 | |
| 2001 | // Convert element |
| Pavel Chupin | 85413ff | 2012-04-24 10:55:48 +0400 | [diff] [blame] | 2002 | CConfigurableElement* pConfigurableElement = static_cast<CConfigurableElement*>(pLocatedElement); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2003 | |
| 2004 | // Delegate |
| 2005 | return getConfigurableDomains()->split(strDomain, pConfigurableElement, strError); |
| 2006 | } |
| 2007 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2008 | bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSettings, |
| 2009 | bool bFromFile, string& strError) |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2010 | { |
| 2011 | // Check tuning mode |
| 2012 | if (!checkTuningModeOn(strError)) { |
| 2013 | |
| 2014 | return false; |
| 2015 | } |
| 2016 | |
| 2017 | // check path is absolute |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2018 | if (bFromFile && strXmlSource[0] != '/') { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2019 | |
| 2020 | strError = "Please provide absolute path"; |
| 2021 | |
| 2022 | return false; |
| 2023 | } |
| 2024 | // Root element |
| 2025 | CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); |
| 2026 | |
| 2027 | // Context |
| David Wagner | d8a5310 | 2014-12-10 14:49:23 +0100 | [diff] [blame] | 2028 | CXmlDomainImportContext xmlDomainImportContext(strError, bWithSettings, *getSystemClass()); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2029 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2030 | // Selection criteria definition for rule creation |
| David Wagner | 29fa61f | 2014-12-19 11:15:02 +0100 | [diff] [blame] | 2031 | xmlDomainImportContext.setSelectionCriteriaDefinition( |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2032 | getConstSelectionCriteria()->getSelectionCriteriaDefinition()); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2033 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2034 | // Init serializing context |
| David Wagner | 29fa61f | 2014-12-19 11:15:02 +0100 | [diff] [blame] | 2035 | xmlDomainImportContext.set( |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2036 | _pElementLibrarySet->getElementLibrary(EParameterConfigurationLibrary), |
| 2037 | "", _strSchemaFolderLocation); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2038 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2039 | // Get Schema file associated to root element |
| 2040 | string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + |
| 2041 | pConfigurableDomains->getKind() + ".xsd"; |
| 2042 | |
| 2043 | // Xml Source |
| 2044 | CXmlDocSource* pSource; |
| 2045 | |
| 2046 | if (bFromFile) { |
| 2047 | |
| 2048 | // when importing from a file strXmlSource is the file name |
| 2049 | pSource = new CXmlFileDocSource(strXmlSource, strXmlSchemaFilePath, |
| 2050 | pConfigurableDomains->getKind(), |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 2051 | pConfigurableDomains->getName(), "SystemClassName", |
| 2052 | _bValidateSchemasOnStart); |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2053 | |
| 2054 | } else { |
| 2055 | |
| 2056 | // when importing from an xml string, strXmlSource contains the string |
| 2057 | pSource = new CXmlStringDocSource(strXmlSource, strXmlSchemaFilePath, |
| 2058 | pConfigurableDomains->getKind(), |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 2059 | pConfigurableDomains->getName(), "SystemClassName", |
| 2060 | _bValidateSchemasOnStart); |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2061 | |
| 2062 | } |
| 2063 | // Start clean |
| 2064 | pConfigurableDomains->clean(); |
| 2065 | |
| 2066 | // Use a doc sink that instantiate Configurable Domains from the given doc source |
| 2067 | CXmlMemoryDocSink memorySink(pConfigurableDomains); |
| 2068 | |
| David Wagner | 29fa61f | 2014-12-19 11:15:02 +0100 | [diff] [blame] | 2069 | bool bProcessSuccess = memorySink.process(*pSource, xmlDomainImportContext); |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2070 | |
| 2071 | if (!bProcessSuccess) { |
| 2072 | |
| 2073 | //Cleanup |
| 2074 | pConfigurableDomains->clean(); |
| 2075 | |
| 2076 | } else { |
| 2077 | |
| 2078 | // Validate domains after XML import |
| 2079 | pConfigurableDomains->validate(_pMainParameterBlackboard); |
| 2080 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2081 | } |
| 2082 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2083 | delete pSource; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2084 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2085 | return bProcessSuccess; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2086 | } |
| 2087 | |
| David Wagner | ed744eb | 2014-12-04 18:38:52 +0100 | [diff] [blame^] | 2088 | bool CParameterMgr::serializeElement(string& strXmlDest, |
| 2089 | CXmlSerializingContext& xmlSerializingContext, bool bToFile, |
| 2090 | const CElement& element, string& strError) const |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2091 | { |
| 2092 | // check path is absolute |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2093 | if (bToFile && strXmlDest[0] != '/') { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2094 | |
| 2095 | strError = "Please provide absolute path"; |
| 2096 | |
| 2097 | return false; |
| 2098 | } |
| 2099 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2100 | // Get Schema file associated to root element |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2101 | string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + |
| David Wagner | ed744eb | 2014-12-04 18:38:52 +0100 | [diff] [blame^] | 2102 | element.getKind() + ".xsd"; |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 2103 | |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 2104 | // Use a doc source by loading data from instantiated Configurable Domains |
| David Wagner | ed744eb | 2014-12-04 18:38:52 +0100 | [diff] [blame^] | 2105 | CXmlMemoryDocSource memorySource(&element, element.getKind(), |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 2106 | strXmlSchemaFilePath, "parameter-framework", |
| 2107 | getVersion(), _bValidateSchemasOnStart); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2108 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2109 | // Xml Sink |
| 2110 | CXmlDocSink* pSink; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2111 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2112 | if (bToFile) { |
| 2113 | |
| 2114 | // Use a doc sink to write the doc data in a file |
| 2115 | pSink = new CXmlFileDocSink(strXmlDest); |
| 2116 | |
| 2117 | } else { |
| 2118 | |
| 2119 | // Use a doc sink to write the doc data in a string |
| David Wagner | ed744eb | 2014-12-04 18:38:52 +0100 | [diff] [blame^] | 2120 | // TODO: use a stream rather than a string |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2121 | pSink = new CXmlStringDocSink(strXmlDest); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2122 | } |
| 2123 | |
| David Wagner | ed744eb | 2014-12-04 18:38:52 +0100 | [diff] [blame^] | 2124 | bool bProcessSuccess = pSink->process(memorySource, xmlSerializingContext); |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2125 | |
| 2126 | delete pSink; |
| 2127 | return bProcessSuccess; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2128 | } |
| 2129 | |
| David Wagner | ed744eb | 2014-12-04 18:38:52 +0100 | [diff] [blame^] | 2130 | bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, bool bToFile, |
| 2131 | string& strError) const |
| 2132 | { |
| 2133 | const CConfigurableDomains* pConfigurableDomains = getConstConfigurableDomains(); |
| 2134 | |
| 2135 | CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings); |
| 2136 | |
| 2137 | xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw); |
| 2138 | |
| 2139 | xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex); |
| 2140 | |
| 2141 | |
| 2142 | return serializeElement(strXmlDest, xmlDomainExportContext, bToFile, |
| 2143 | *pConfigurableDomains, strError); |
| 2144 | } |
| 2145 | |
| 2146 | bool CParameterMgr::exportSingleDomainXml(string& strXmlDest, const string& strDomainName, |
| 2147 | bool bWithSettings, bool bToFile, string& strError) const |
| 2148 | { |
| 2149 | const CConfigurableDomains* pAllDomains = getConstConfigurableDomains(); |
| 2150 | |
| 2151 | // Element to be serialized |
| 2152 | const CConfigurableDomain* pRequestedDomain = |
| 2153 | pAllDomains->findConfigurableDomain(strDomainName, strError); |
| 2154 | |
| 2155 | if (!pRequestedDomain) { |
| 2156 | return false; |
| 2157 | } |
| 2158 | |
| 2159 | CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings); |
| 2160 | |
| 2161 | xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw); |
| 2162 | |
| 2163 | xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex); |
| 2164 | |
| 2165 | return serializeElement(strXmlDest, xmlDomainExportContext, bToFile, |
| 2166 | *pRequestedDomain, strError); |
| 2167 | } |
| 2168 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2169 | // Binary Import/Export |
| 2170 | bool CParameterMgr::importDomainsBinary(const string& strFileName, string& strError) |
| 2171 | { |
| 2172 | // Check tuning mode |
| 2173 | if (!checkTuningModeOn(strError)) { |
| 2174 | |
| 2175 | return false; |
| 2176 | } |
| 2177 | // check path is absolute |
| 2178 | if (strFileName[0] != '/') { |
| 2179 | |
| 2180 | strError = "Please provide absolute path"; |
| 2181 | |
| 2182 | return false; |
| 2183 | } |
| 2184 | // Root element |
| 2185 | CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); |
| 2186 | |
| 2187 | // Serialize in |
| 2188 | return pConfigurableDomains->serializeSettings(strFileName, false, _uiStructureChecksum, strError); |
| 2189 | } |
| 2190 | |
| 2191 | bool CParameterMgr::exportDomainsBinary(const string& strFileName, string& strError) |
| 2192 | { |
| 2193 | // check path is absolute |
| 2194 | if (strFileName[0] != '/') { |
| 2195 | |
| 2196 | strError = "Please provide absolute path"; |
| 2197 | |
| 2198 | return false; |
| 2199 | } |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2200 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2201 | // Root element |
| 2202 | CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); |
| 2203 | |
| 2204 | // Serialize out |
| 2205 | return pConfigurableDomains->serializeSettings(strFileName, true, _uiStructureChecksum, strError); |
| 2206 | } |
| 2207 | |
| 2208 | // For tuning, check we're in tuning mode |
| 2209 | bool CParameterMgr::checkTuningModeOn(string& strError) const |
| 2210 | { |
| 2211 | // Tuning Mode on? |
| 2212 | if (!_bTuningModeIsOn) { |
| 2213 | |
| 2214 | strError = "Tuning Mode must be on"; |
| 2215 | |
| 2216 | return false; |
| 2217 | } |
| 2218 | return true; |
| 2219 | } |
| 2220 | |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 2221 | // Tuning mutex dynamic parameter handling |
| 2222 | pthread_mutex_t* CParameterMgr::getBlackboardMutex() |
| Patrick Benavoli | 4bed921 | 2011-10-27 14:18:00 +0200 | [diff] [blame] | 2223 | { |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 2224 | return &_blackboardMutex; |
| Patrick Benavoli | 4bed921 | 2011-10-27 14:18:00 +0200 | [diff] [blame] | 2225 | } |
| 2226 | |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 2227 | // Blackboard reference (dynamic parameter handling) |
| 2228 | CParameterBlackboard* CParameterMgr::getParameterBlackboard() |
| Patrick Benavoli | 4bed921 | 2011-10-27 14:18:00 +0200 | [diff] [blame] | 2229 | { |
| Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 2230 | return _pMainParameterBlackboard; |
| Patrick Benavoli | 4bed921 | 2011-10-27 14:18:00 +0200 | [diff] [blame] | 2231 | } |
| 2232 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2233 | // Dynamic creation library feeding |
| 2234 | void CParameterMgr::feedElementLibraries() |
| 2235 | { |
| 2236 | // Global Configuration handling |
| 2237 | CElementLibrary* pFrameworkConfigurationLibrary = new CElementLibrary; |
| 2238 | |
| Kevin Rocard | a7b6960 | 2013-08-07 16:15:33 +0200 | [diff] [blame] | 2239 | pFrameworkConfigurationLibrary->addElementBuilder("ParameterFrameworkConfiguration", new TElementBuilderTemplate<CParameterFrameworkConfiguration>()); |
| 2240 | pFrameworkConfigurationLibrary->addElementBuilder("SubsystemPlugins", new TKindElementBuilderTemplate<CSubsystemPlugins>()); |
| 2241 | pFrameworkConfigurationLibrary->addElementBuilder("Location", new TKindElementBuilderTemplate<CPluginLocation>()); |
| 2242 | pFrameworkConfigurationLibrary->addElementBuilder("StructureDescriptionFileLocation", new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>()); |
| 2243 | pFrameworkConfigurationLibrary->addElementBuilder("SettingsConfiguration", new TKindElementBuilderTemplate<CFrameworkConfigurationGroup>()); |
| 2244 | pFrameworkConfigurationLibrary->addElementBuilder("ConfigurableDomainsFileLocation", new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>()); |
| 2245 | pFrameworkConfigurationLibrary->addElementBuilder("BinarySettingsFileLocation", new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>()); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2246 | |
| 2247 | _pElementLibrarySet->addElementLibrary(pFrameworkConfigurationLibrary); |
| 2248 | |
| 2249 | // Parameter creation |
| 2250 | CElementLibrary* pParameterCreationLibrary = new CElementLibrary; |
| 2251 | |
| Kevin Rocard | a7b6960 | 2013-08-07 16:15:33 +0200 | [diff] [blame] | 2252 | pParameterCreationLibrary->addElementBuilder("Subsystem", new CSubsystemElementBuilder(getSystemClass()->getSubsystemLibrary())); |
| 2253 | pParameterCreationLibrary->addElementBuilder("ComponentType", new TNamedElementBuilderTemplate<CComponentType>()); |
| 2254 | pParameterCreationLibrary->addElementBuilder("Component", new TNamedElementBuilderTemplate<CComponentInstance>()); |
| 2255 | pParameterCreationLibrary->addElementBuilder("BitParameter", new TNamedElementBuilderTemplate<CBitParameterType>()); |
| 2256 | pParameterCreationLibrary->addElementBuilder("BitParameterBlock", new TNamedElementBuilderTemplate<CBitParameterBlockType>()); |
| 2257 | pParameterCreationLibrary->addElementBuilder("StringParameter", new TNamedElementBuilderTemplate<CStringParameterType>()); |
| 2258 | pParameterCreationLibrary->addElementBuilder("ParameterBlock", new TNamedElementBuilderTemplate<CParameterBlockType>()); |
| 2259 | pParameterCreationLibrary->addElementBuilder("BooleanParameter", new TNamedElementBuilderTemplate<CBooleanParameterType>()); |
| 2260 | pParameterCreationLibrary->addElementBuilder("IntegerParameter", new TNamedElementBuilderTemplate<CIntegerParameterType>()); |
| 2261 | pParameterCreationLibrary->addElementBuilder("LinearAdaptation", new TElementBuilderTemplate<CLinearParameterAdaptation>()); |
| 2262 | pParameterCreationLibrary->addElementBuilder("EnumParameter", new TNamedElementBuilderTemplate<CEnumParameterType>()); |
| 2263 | pParameterCreationLibrary->addElementBuilder("ValuePair", new TElementBuilderTemplate<CEnumValuePair>()); |
| 2264 | pParameterCreationLibrary->addElementBuilder("FixedPointParameter", new TNamedElementBuilderTemplate<CFixedPointParameterType>()); |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 2265 | pParameterCreationLibrary->addElementBuilder("SubsystemInclude", new CFileIncluderElementBuilder(_bValidateSchemasOnStart)); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2266 | |
| 2267 | _pElementLibrarySet->addElementLibrary(pParameterCreationLibrary); |
| 2268 | |
| 2269 | // Parameter Configuration Domains creation |
| 2270 | CElementLibrary* pParameterConfigurationLibrary = new CElementLibrary; |
| 2271 | |
| Kevin Rocard | a7b6960 | 2013-08-07 16:15:33 +0200 | [diff] [blame] | 2272 | pParameterConfigurationLibrary->addElementBuilder("ConfigurableDomain", new TNamedElementBuilderTemplate<CConfigurableDomain>()); |
| 2273 | pParameterConfigurationLibrary->addElementBuilder("Configuration", new TNamedElementBuilderTemplate<CDomainConfiguration>()); |
| 2274 | pParameterConfigurationLibrary->addElementBuilder("CompoundRule", new TElementBuilderTemplate<CCompoundRule>()); |
| 2275 | pParameterConfigurationLibrary->addElementBuilder("SelectionCriterionRule", new TElementBuilderTemplate<CSelectionCriterionRule>()); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2276 | |
| 2277 | _pElementLibrarySet->addElementLibrary(pParameterConfigurationLibrary); |
| 2278 | } |
| 2279 | |
| 2280 | // Remote Processor Server connection handling |
| 2281 | bool CParameterMgr::handleRemoteProcessingInterface(string& strError) |
| 2282 | { |
| 2283 | CAutoLog autoLog(this, "Handling remote processing interface"); |
| 2284 | |
| 2285 | // Start server if tuning allowed |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 2286 | if (getConstFrameworkConfiguration()->isTuningAllowed()) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2287 | |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 2288 | log_info("Loading remote processor library"); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2289 | |
| 2290 | // Load library |
| Renaud de Chivre | 1b8b3ca | 2013-12-13 15:09:44 +0100 | [diff] [blame] | 2291 | _handleLibRemoteProcessor = dlopen("libremote-processor.so", RTLD_NOW); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2292 | |
| Renaud de Chivre | 1b8b3ca | 2013-12-13 15:09:44 +0100 | [diff] [blame] | 2293 | if (!_handleLibRemoteProcessor) { |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2294 | |
| 2295 | // Return error |
| 2296 | const char* pcError = dlerror(); |
| 2297 | |
| 2298 | if (pcError) { |
| 2299 | |
| 2300 | strError = pcError; |
| 2301 | } else { |
| 2302 | |
| 2303 | strError = "Unable to load libremote-processor.so library"; |
| 2304 | } |
| 2305 | |
| 2306 | return false; |
| 2307 | } |
| 2308 | |
| Renaud de Chivre | 1b8b3ca | 2013-12-13 15:09:44 +0100 | [diff] [blame] | 2309 | CreateRemoteProcessorServer pfnCreateRemoteProcessorServer = (CreateRemoteProcessorServer)dlsym(_handleLibRemoteProcessor, "createRemoteProcessorServer"); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2310 | |
| 2311 | if (!pfnCreateRemoteProcessorServer) { |
| 2312 | |
| 2313 | strError = "libremote-process.so does not contain createRemoteProcessorServer symbol."; |
| 2314 | |
| 2315 | return false; |
| 2316 | } |
| 2317 | |
| 2318 | // Create server |
| Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 2319 | _pRemoteProcessorServer = pfnCreateRemoteProcessorServer(getConstFrameworkConfiguration()->getServerPort(), _pCommandHandler); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2320 | |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 2321 | log_info("Starting remote processor server on port %d", getConstFrameworkConfiguration()->getServerPort()); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2322 | // Start |
| 2323 | if (!_pRemoteProcessorServer->start()) { |
| 2324 | |
| Frédéric Boisnard | 6c55e9a | 2014-01-10 18:46:33 +0100 | [diff] [blame] | 2325 | ostringstream oss; |
| 2326 | oss << "ParameterMgr: Unable to start remote processor server on port " |
| 2327 | << getConstFrameworkConfiguration()->getServerPort(); |
| 2328 | strError = oss.str(); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2329 | |
| 2330 | return false; |
| 2331 | } |
| 2332 | } |
| 2333 | |
| 2334 | return true; |
| 2335 | } |
| 2336 | |
| 2337 | // Back synchronization |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 2338 | CBackSynchronizer* CParameterMgr::createBackSynchronizer() const |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2339 | { |
| 2340 | #ifdef SIMULATION |
| 2341 | // In simulation, back synchronization of the blackboard won't probably work |
| 2342 | // We need to ensure though the blackboard is initialized with valid data |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 2343 | return new CSimulatedBackSynchronizer(getConstSystemClass(), _pMainParameterBlackboard); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2344 | #else |
| 2345 | // Real back synchronizer from subsystems |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 2346 | return new CHardwareBackSynchronizer(getConstSystemClass(), _pMainParameterBlackboard); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2347 | #endif |
| 2348 | } |
| 2349 | |
| 2350 | // Children typwise access |
| 2351 | CParameterFrameworkConfiguration* CParameterMgr::getFrameworkConfiguration() |
| 2352 | { |
| 2353 | return static_cast<CParameterFrameworkConfiguration*>(getChild(EFrameworkConfiguration)); |
| 2354 | } |
| 2355 | |
| 2356 | const CParameterFrameworkConfiguration* CParameterMgr::getConstFrameworkConfiguration() |
| 2357 | { |
| 2358 | return getFrameworkConfiguration(); |
| 2359 | } |
| 2360 | |
| 2361 | CSelectionCriteria* CParameterMgr::getSelectionCriteria() |
| 2362 | { |
| 2363 | return static_cast<CSelectionCriteria*>(getChild(ESelectionCriteria)); |
| 2364 | } |
| 2365 | |
| 2366 | const CSelectionCriteria* CParameterMgr::getConstSelectionCriteria() |
| 2367 | { |
| 2368 | return static_cast<const CSelectionCriteria*>(getChild(ESelectionCriteria)); |
| 2369 | } |
| 2370 | |
| 2371 | CSystemClass* CParameterMgr::getSystemClass() |
| 2372 | { |
| 2373 | return static_cast<CSystemClass*>(getChild(ESystemClass)); |
| 2374 | } |
| 2375 | |
| 2376 | const CSystemClass* CParameterMgr::getConstSystemClass() const |
| 2377 | { |
| 2378 | return static_cast<const CSystemClass*>(getChild(ESystemClass)); |
| 2379 | } |
| 2380 | |
| 2381 | // Configurable Domains |
| 2382 | CConfigurableDomains* CParameterMgr::getConfigurableDomains() |
| 2383 | { |
| 2384 | return static_cast<CConfigurableDomains*>(getChild(EConfigurableDomains)); |
| 2385 | } |
| 2386 | |
| 2387 | const CConfigurableDomains* CParameterMgr::getConstConfigurableDomains() |
| 2388 | { |
| 2389 | return static_cast<const CConfigurableDomains*>(getChild(EConfigurableDomains)); |
| 2390 | } |
| 2391 | |
| 2392 | const CConfigurableDomains* CParameterMgr::getConstConfigurableDomains() const |
| 2393 | { |
| 2394 | return static_cast<const CConfigurableDomains*>(getChild(EConfigurableDomains)); |
| 2395 | } |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 2396 | |
| Guillaume Denneulin | f2fd15a | 2012-12-20 17:53:29 +0100 | [diff] [blame] | 2397 | // Apply configurations |
| 2398 | void CParameterMgr::doApplyConfigurations(bool bForce) |
| 2399 | { |
| 2400 | CSyncerSet syncerSet; |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 2401 | |
| Guillaume Denneulin | f2fd15a | 2012-12-20 17:53:29 +0100 | [diff] [blame] | 2402 | // Check subsystems that need resync |
| 2403 | getSystemClass()->checkForSubsystemsToResync(syncerSet); |
| 2404 | |
| 2405 | // Ensure application of currently selected configurations |
| 2406 | getConfigurableDomains()->apply(_pMainParameterBlackboard, syncerSet, bForce); |
| 2407 | |
| 2408 | // Reset the modified status of the current criteria to indicate that a new configuration has been applied |
| 2409 | getSelectionCriteria()->resetModifiedStatus(); |
| 2410 | } |
| 2411 | |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 2412 | bool CParameterMgr::getSystemClassXMLString(string& strResult) |
| 2413 | { |
| 2414 | // Root element |
| 2415 | const CSystemClass* pSystemClass = getSystemClass(); |
| 2416 | |
| 2417 | string strError; |
| 2418 | |
| 2419 | CXmlSerializingContext xmlSerializingContext(strError); |
| 2420 | |
| 2421 | // Use a doc source by loading data from instantiated Configurable Domains |
| Mattijs Korpershoek | cce85f6 | 2014-04-08 14:10:03 +0200 | [diff] [blame] | 2422 | CXmlMemoryDocSource memorySource(pSystemClass, pSystemClass->getKind(), |
| 2423 | _bValidateSchemasOnStart); |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 2424 | |
| 2425 | // Use a doc sink that write the doc data in a string |
| 2426 | CXmlStringDocSink stringSink(strResult); |
| 2427 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2428 | bool bProcessSuccess = stringSink.process(memorySource, xmlSerializingContext); |
| 2429 | |
| 2430 | if (!bProcessSuccess) { |
| 2431 | |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 2432 | strResult = strError; |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2433 | |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 2434 | } |
| 2435 | |
| Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 2436 | return bProcessSuccess; |
| Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 2437 | } |