blob: 7d64e5cbc2ac80719589ad486c6eed4d68de64a7 [file] [log] [blame]
David Wagnerb76c9d62014-02-05 18:30:24 +01001/*
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 Benavoli68a91282011-08-31 11:23:23 +020029 */
30#pragma once
31
32#include <pthread.h>
Kevin Rocardace81f82012-12-11 16:19:17 +010033#include <map>
34#include <vector>
35#include <list>
Patrick Benavoli63499d42011-10-24 18:50:03 +020036#include "RemoteCommandHandlerTemplate.h"
Patrick Benavoli68a91282011-08-31 11:23:23 +020037#include "PathNavigator.h"
38#include "SelectionCriterionType.h"
39#include "SelectionCriterion.h"
40#include "Element.h"
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020041#include "XmlDocSink.h"
42#include "XmlDocSource.h"
Patrick Benavoli68a91282011-08-31 11:23:23 +020043
Patrick Benavoli592ae562011-09-05 16:53:58 +020044
Patrick Benavoli68a91282011-08-31 11:23:23 +020045class CElementLibrarySet;
46class CSubsystemLibrary;
47class CSystemClass;
48class CSelectionCriteria;
49class CParameterFrameworkConfiguration;
50class CSystemClassConfiguration;
51class CParameterBlackboard;
52class CConfigurableDomains;
53class IRemoteProcessorServerInterface;
54class CBackSynchronizer;
Patrick Benavoli065264a2011-11-20 15:46:41 +010055class CParameterHandle;
Guillaume Denneulina4ec15d2012-02-17 14:38:14 +010056class CSubsystemPlugins;
Frédéric Boisnarde42dacd2013-02-25 15:56:56 +010057class CParameterAccessContext;
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +020058class CConfigurableElement;
Patrick Benavoli68a91282011-08-31 11:23:23 +020059
Patrick Benavoli63499d42011-10-24 18:50:03 +020060class CParameterMgr : private CElement
Patrick Benavoli68a91282011-08-31 11:23:23 +020061{
62 enum ChildElement {
63 EFrameworkConfiguration,
64 ESelectionCriteria,
65 ESystemClass,
66 EConfigurableDomains
67 };
68 enum ElementLibrary {
69 EFrameworkConfigurationLibrary,
70 EParameterCreationLibrary,
71 EParameterConfigurationLibrary
72 };
Patrick Benavoli68a91282011-08-31 11:23:23 +020073
74 // Remote command parsers
Patrick Benavoli065264a2011-11-20 15:46:41 +010075 typedef TRemoteCommandHandlerTemplate<CParameterMgr> CCommandHandler;
76
Patrick Benavoli63499d42011-10-24 18:50:03 +020077 typedef CCommandHandler::CommandStatus (CParameterMgr::*RemoteCommandParser)(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +020078
79 // Parser descriptions
80 struct SRemoteCommandParserItem
81 {
82 const char* _pcCommandName;
83 CParameterMgr::RemoteCommandParser _pfnParser;
84 uint32_t _uiMinArgumentCount;
85 const char* _pcHelp;
86 const char* _pcDescription;
Patrick Benavoli68a91282011-08-31 11:23:23 +020087 };
Patrick Benavoli592ae562011-09-05 16:53:58 +020088 // Version
Patrick Benavoli065264a2011-11-20 15:46:41 +010089 static const uint32_t guiEditionMajor = 0x2;
Kevin Rocard265e43c2013-06-20 18:55:22 +020090 static const uint32_t guiEditionMinor = 0x2;
Patrick Benavoli63499d42011-10-24 18:50:03 +020091 static const uint32_t guiRevision = 0x0;
Patrick Benavoli065264a2011-11-20 15:46:41 +010092
93 // Parameter handle friendship
94 friend class CParameterHandle;
Patrick Benavoli68a91282011-08-31 11:23:23 +020095public:
96 // Logger interface
97 class ILogger
98 {
99 public:
Kevin Rocardace81f82012-12-11 16:19:17 +0100100 virtual void log(bool bIsWarning, const std::string& strLog) = 0;
Sebastien Gonzalved7e48442013-03-12 14:30:27 +0100101 protected:
102 virtual ~ILogger() {}
Patrick Benavoli68a91282011-08-31 11:23:23 +0200103 };
104
105 // Construction
Patrick Benavoli95ac0342011-11-07 20:32:51 +0100106 CParameterMgr(const string& strConfigurationFilePath);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200107 virtual ~CParameterMgr();
108
109 // Logging
110 void setLogger(ILogger* pLogger);
111
Kevin Rocardecf93102013-07-10 18:28:10 +0200112 /** Load plugins, structures and settings from the config file given.
113 *
114 * @param[out] strError is a string describing the error if an error occurred
115 * undefined otherwise.
116 *
117 * @return true if no error occurred, false otherwise.
118 */
Patrick Benavoli68a91282011-08-31 11:23:23 +0200119 bool load(string& strError);
120 virtual bool init(string& strError);
121
122 // Selection Criteria
123 CSelectionCriterionType* createSelectionCriterionType(bool bIsInclusive);
124 CSelectionCriterion* createSelectionCriterion(const string& strName, const CSelectionCriterionType* pSelectionCriterionType);
Patrick Benavolib71ccf72011-09-13 14:15:52 +0200125 // Selection criterion retrieval
126 CSelectionCriterion* getSelectionCriterion(const string& strName);
127
128 // Configuration application
Kevin Rocardace81f82012-12-11 16:19:17 +0100129 void applyConfigurations();
Patrick Benavoli68a91282011-08-31 11:23:23 +0200130
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200131 /**
132 * Returns the CConfigurableElement corresponding to the path given in argument.
133 *
134 * @param[in] strPath A string representing a path to an element.
135 * @param[out] strError Error message
136 *
137 * @return A const pointer to the corresponding CConfigurableElement.
138 * On error, NULL is returned and the error is explained in strError.
139 */
140 const CConfigurableElement* getConfigurableElement(const string& strPath,
141 string& strError) const;
Patrick Benavoli4bed9212011-10-27 14:18:00 +0200142 // Dynamic parameter handling
Patrick Benavoli065264a2011-11-20 15:46:41 +0100143 CParameterHandle* createParameterHandle(const string& strPath, string& strError);
Patrick Benavoli4bed9212011-10-27 14:18:00 +0200144
Kevin Rocardecf93102013-07-10 18:28:10 +0200145 /** Should start fail in case of missing subsystems.
Kevin Rocardecf93102013-07-10 18:28:10 +0200146 *
Kevin Rocardd6909eb2013-07-18 09:13:51 +0200147 * @param[in] bFail: If set to true, parameterMgr start will fail on missing subsystems.
148 * If set to false, missing subsystems will fallback on virtual subsystem.
Kevin Rocardecf93102013-07-10 18:28:10 +0200149 */
150 void setFailureOnMissingSubsystem(bool bFail);
151
152 /** Would start fail in case of missing subsystems.
153 *
154 * @return true if the subsystem will fail on missing subsystem, false otherwise.
155 */
156 bool getFailureOnMissingSubsystem() const;
157
Kevin Rocardd6909eb2013-07-18 09:13:51 +0200158 /** Should start fail in failed settings load.
159 *
160 * @param[in] bFail: If set to true, parameterMgr start will fail on failed settings load.
161 * If set to false, failed settings load will be ignored.
162 */
163 void setFailureOnFailedSettingsLoad(bool bFail);
164 /** Would start fail in case of failed settings load.
165 *
166 * @return failure on failed settings load policy state.
167 */
168 bool getFailureOnFailedSettingsLoad();
169
Mattijs Korpershoekcce85f62014-04-08 14:10:03 +0200170 /** Should .xml files be validated on start ?
171 *
172 * @param[in] bValidate:
173 * If set to true, parameterMgr will report an error
174 * when being unable to validate .xml files
175 * If set to false, no .xml/xsd validation will happen
176 * (default behaviour)
177 *
178 * @return false if unable to set, true otherwise.
179 */
180 void setValidateSchemasOnStart(bool bValidate);
181
182 /** Would .xml files be validated on start?
183 *
184 * @return areSchemasValidated
185 */
186 bool getValidateSchemasOnStart() const;
187
Patrick Benavoli68a91282011-08-31 11:23:23 +0200188 //////////// Tuning /////////////
189 // Tuning mode
190 bool setTuningMode(bool bOn, string& strError);
191 bool tuningModeOn() const;
192
193 // Current value space for user set/get value interpretation
194 void setValueSpace(bool bIsRaw);
195 bool valueSpaceIsRaw();
196
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200197 // Current Output Raw Format for user get value interpretation
198 void setOutputRawFormat(bool bIsHex);
199 bool outputRawFormatIsHex();
200
Patrick Benavoli68a91282011-08-31 11:23:23 +0200201 // Automatic hardware synchronization control (during tuning session)
202 bool setAutoSync(bool bAutoSyncOn, string& strError);
203 bool autoSyncOn() const;
204 bool sync(string& strError);
205
206 // User set/get parameters
Frédéric Boisnarde42dacd2013-02-25 15:56:56 +0100207 bool accessValue(CParameterAccessContext& parameterAccessContext, const string& strPath, string& strValue, bool bSet, string& strError);
208 bool accessParameterValue(const string& strPath, string& strValue, bool bSet, string& strError);
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200209 /**
210 * Returns the element mapping corresponding to the path given in parameter.
211 *
212 * @param[in] strPath Path of an element
213 * @param[out] strValue A sting containing the mapping
214 *
215 * @return true if a mapping was found for this element
216 */
217 bool getParameterMapping(const string& strPath, string& strValue) const;
Frédéric Boisnarde42dacd2013-02-25 15:56:56 +0100218 bool accessConfigurationValue(const string &strDomain, const string &stConfiguration, const string& strPath, string& strValue, bool bSet, string& strError);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200219
220 ////////// Configuration/Domains handling //////////////
221 // Creation/Deletion
222 bool createDomain(const string& strName, string& strError);
223 bool deleteDomain(const string& strName, string& strError);
Kevin Rocard170f0a42012-06-18 13:56:05 +0200224 bool deleteAllDomains(string& strError);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200225 bool createConfiguration(const string& strDomain, const string& strConfiguration, string& strError);
226 bool deleteConfiguration(const string& strDomain, const string& strConfiguration, string& strError);
227
228 // Save/Restore
Kevin Rocardace81f82012-12-11 16:19:17 +0100229 bool restoreConfiguration(const string& strDomain, const string& strConfiguration, list<string>& strError);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200230 bool saveConfiguration(const string& strDomain, const string& strConfiguration, string& strError);
231
232 // Configurable element - domain association
233 bool addConfigurableElementToDomain(const string& strDomain, const string& strConfigurableElementPath, string& strError);
234 bool removeConfigurableElementFromDomain(const string& strDomain, const string& strConfigurableElementPath, string& strError);
235 bool split(const string& strDomain, const string& strConfigurableElementPath, string& strError);
236
Georges-Henri Baroncec86c12012-09-04 17:30:28 +0200237 /**
238 * Method that imports Configurable Domains from an Xml source.
239 *
240 * @param[in] strXmlSource a string containing an xml description or a path to an xml file
241 * @param[in] bWithSettings a boolean that determines if the settings should be used in the
242 * xml description
243 * @param[in] bFromFile a boolean that determines if the source is an xml description in
244 * strXmlSource or contained in a file. In that case strXmlSource is just the file path.
245 * @param[out] strError is used as the error output
246 *
247 * @return false if any error occures
248 */
249 bool importDomainsXml(const string& strXmlSource, bool bWithSettings, bool bFromFile,
250 string& strError);
251
252 /**
253 * Method that exports Configurable Domains to an Xml destination.
254 * If bToFile is false, the xml description from the xml document will be written
255 * in strXmlDest. Otherwise it will be written in a file located at the path in strXmlDest
256 *
257 * @param[in:out] strXmlDest a string containing an xml description or a path to an xml file
258 * @param[in] bWithSettings a boolean that determines if the settings should be used in the
259 * xml description
260 * @param[in] bToFile a boolean that determines if the destination is an xml description in
261 * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
262 * @param[out] strError is used as the error output
263 *
264 * @return false if any error occures
265 */
266 bool exportDomainsXml(string& strXmlDest, bool bWithSettings, bool bToFile,
267 string& strError) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200268
269 // Binary Import/Export
270 bool importDomainsBinary(const string& strFileName, string& strError);
271 bool exportDomainsBinary(const string& strFileName, string& strError);
272
Georges-Henri Baroncec86c12012-09-04 17:30:28 +0200273 /**
274 * Method that creates an Xml description of the instanciated parameter structure contained
275 * in SystemClass.
276 *
277 * @param[out] strResult contains the xml description of SystemClass or the errors if any
278 *
279 * @return false if any error occures during the creation of the xml description
280 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +0200281 bool getSystemClassXMLString(string& strResult);
282
Patrick Benavoli68a91282011-08-31 11:23:23 +0200283 // Introspect
284 void logStructureContent(string& strContent) const;
285
286 // CElement
287 virtual string getKind() const;
Kevin Rocardace81f82012-12-11 16:19:17 +0100288
Patrick Benavoli68a91282011-08-31 11:23:23 +0200289private:
JhinX Lee4ebc0982012-07-12 17:50:07 +0200290 CParameterMgr(const CParameterMgr&);
291 CParameterMgr& operator=(const CParameterMgr&);
292
Patrick Benavoli68a91282011-08-31 11:23:23 +0200293 // Logging (done by root)
Kevin Rocardace81f82012-12-11 16:19:17 +0100294 virtual void doLog(bool bIsWarning, const string& strLog) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200295 virtual void nestLog() const;
296 virtual void unnestLog() const;
297
Patrick Benavoli63499d42011-10-24 18:50:03 +0200298 // Version
299 string getVersion() const;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200300
301 ////////////////:: Remote command parsers
Patrick Benavoli592ae562011-09-05 16:53:58 +0200302 /// Version
Patrick Benavoli63499d42011-10-24 18:50:03 +0200303 CCommandHandler::CommandStatus versionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200304 /// Status
Patrick Benavoli63499d42011-10-24 18:50:03 +0200305 CCommandHandler::CommandStatus statusCommandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200306 /// Tuning Mode
Patrick Benavoli63499d42011-10-24 18:50:03 +0200307 CCommandHandler::CommandStatus setTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
308 CCommandHandler::CommandStatus getTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200309 /// Value Space
Patrick Benavoli63499d42011-10-24 18:50:03 +0200310 CCommandHandler::CommandStatus setValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
311 CCommandHandler::CommandStatus getValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200312 /// Output Raw Format
Patrick Benavoli63499d42011-10-24 18:50:03 +0200313 CCommandHandler::CommandStatus setOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
314 CCommandHandler::CommandStatus getOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200315 /// Sync
Patrick Benavoli63499d42011-10-24 18:50:03 +0200316 CCommandHandler::CommandStatus setAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
317 CCommandHandler::CommandStatus getAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
318 CCommandHandler::CommandStatus syncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200319 /// Criteria
Patrick Benavoli63499d42011-10-24 18:50:03 +0200320 CCommandHandler::CommandStatus listCriteriaCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200321 /// Domains
Patrick Benavoli63499d42011-10-24 18:50:03 +0200322 CCommandHandler::CommandStatus listDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
323 CCommandHandler::CommandStatus createDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
324 CCommandHandler::CommandStatus deleteDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Kevin Rocard170f0a42012-06-18 13:56:05 +0200325 CCommandHandler::CommandStatus deleteAllDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli63499d42011-10-24 18:50:03 +0200326 CCommandHandler::CommandStatus renameDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
327 CCommandHandler::CommandStatus setSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
328 CCommandHandler::CommandStatus getSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
329 CCommandHandler::CommandStatus listDomainElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
330 CCommandHandler::CommandStatus addElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
331 CCommandHandler::CommandStatus removeElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
332 CCommandHandler::CommandStatus splitDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200333 /// Configurations
Patrick Benavoli63499d42011-10-24 18:50:03 +0200334 CCommandHandler::CommandStatus listConfigurationsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli0bd50542011-11-29 11:10:27 +0100335 CCommandHandler::CommandStatus dumpDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli63499d42011-10-24 18:50:03 +0200336 CCommandHandler::CommandStatus createConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
337 CCommandHandler::CommandStatus deleteConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
338 CCommandHandler::CommandStatus renameConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
339 CCommandHandler::CommandStatus saveConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
340 CCommandHandler::CommandStatus restoreConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
341 CCommandHandler::CommandStatus setElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
342 CCommandHandler::CommandStatus getElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli0bd50542011-11-29 11:10:27 +0100343 CCommandHandler::CommandStatus setRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
344 CCommandHandler::CommandStatus clearRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
345 CCommandHandler::CommandStatus getRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200346 /// Elements/Parameters
Patrick Benavoli63499d42011-10-24 18:50:03 +0200347 CCommandHandler::CommandStatus listElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
348 CCommandHandler::CommandStatus listParametersCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
349 CCommandHandler::CommandStatus dumpElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
350 CCommandHandler::CommandStatus getElementSizeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
351 CCommandHandler::CommandStatus showPropertiesCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
352 CCommandHandler::CommandStatus getParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
353 CCommandHandler::CommandStatus setParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Frédéric Boisnarde42dacd2013-02-25 15:56:56 +0100354 CCommandHandler::CommandStatus getConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
355 CCommandHandler::CommandStatus setConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli63499d42011-10-24 18:50:03 +0200356 CCommandHandler::CommandStatus listBelongingDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
357 CCommandHandler::CommandStatus listAssociatedDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200358 CCommandHandler::CommandStatus showMappingCommmandProcess(const IRemoteCommand& remoteCommand,
359 string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200360 /// Browse
Patrick Benavoli63499d42011-10-24 18:50:03 +0200361 CCommandHandler::CommandStatus listAssociatedElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
362 CCommandHandler::CommandStatus listConflictingElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
363 CCommandHandler::CommandStatus listRogueElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200364 /// Settings Import/Export
Patrick Benavoli63499d42011-10-24 18:50:03 +0200365 CCommandHandler::CommandStatus exportConfigurableDomainsToXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
366 CCommandHandler::CommandStatus importConfigurableDomainsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
367 CCommandHandler::CommandStatus exportConfigurableDomainsWithSettingsToXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
368 CCommandHandler::CommandStatus importConfigurableDomainsWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
369 CCommandHandler::CommandStatus exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
370 CCommandHandler::CommandStatus importSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult);
Georges-Henri Baroncec86c12012-09-04 17:30:28 +0200371
372 /**
373 * Command handler method for getConfigurableDomainWithSettings command.
374 *
375 * @param[in] remoteCommand contains the arguments of the received command.
376 * @param[out] strResult a string containing the result of the command
377 *
378 * @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
379 * in the other case
380 */
381 CCommandHandler::CommandStatus getConfigurableDomainsWithSettingsXMLCommmandProcess(
382 const IRemoteCommand& remoteCommand, string& strResult);
383
384 /**
385 * Command handler method for setConfigurableDomainWithSettings command.
386 *
387 * @param[in] remoteCommand contains the arguments of the received command.
388 * @param[out] strResult a string containing the result of the command
389 *
390 * @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
391 * in the other case
392 */
393 CCommandHandler::CommandStatus setConfigurableDomainsWithSettingsXMLCommmandProcess(
394 const IRemoteCommand& remoteCommand, string& strResult);
395
396 /**
397 * Command handler method for getSystemClass command.
398 *
399 * @param[in] remoteCommand contains the arguments of the received command.
400 * @param[out] strResult a string containing the result of the command
401 *
402 * @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
403 * in the other case
404 */
405 CCommandHandler::CommandStatus getSystemClassXMLCommmandProcess(
406 const IRemoteCommand& remoteCommand, string& strResult);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200407
408 // Max command usage length, use for formatting
409 void setMaxCommandUsageLength();
410
411 // For tuning, check we're in tuning mode
412 bool checkTuningModeOn(string& strError) const;
413
Patrick Benavoli065264a2011-11-20 15:46:41 +0100414 // Blackboard (dynamic parameter handling)
415 pthread_mutex_t* getBlackboardMutex();
416
417 // Blackboard reference (dynamic parameter handling)
418 CParameterBlackboard* getParameterBlackboard();
419
Patrick Benavoli4bed9212011-10-27 14:18:00 +0200420 // Parameter access
Patrick Benavoli065264a2011-11-20 15:46:41 +0100421 bool doSetValue(const string& strPath, const string& strValue, bool bRawValueSpace, bool bDynamicAccess, string& strError) const;
Patrick Benavoli4bed9212011-10-27 14:18:00 +0200422 bool doGetValue(const string& strPath, string& strValue, bool bRawValueSpace, bool bHexOutputRawFormat, bool bDynamicAccess, string& strError) const;
423
Patrick Benavoli68a91282011-08-31 11:23:23 +0200424 // Framework global configuration loading
425 bool loadFrameworkConfiguration(string& strError);
426
427 // System class Structure loading
428 bool loadStructure(string& strError);
429
430 // System class Structure loading
431 bool loadSettings(string& strError);
Kevin Rocardd6909eb2013-07-18 09:13:51 +0200432 bool loadSettingsFromConfigFile(string& strError);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200433
434 // Parse XML file into Root element
435 bool xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const string& strXmlFilePath, const string& strXmlFolder, ElementLibrary eElementLibrary, const string& strNameAttrituteName = "Name");
436
437 // Framework Configuration
438 CParameterFrameworkConfiguration* getFrameworkConfiguration();
439 const CParameterFrameworkConfiguration* getConstFrameworkConfiguration();
440
441 // Selection Criteria
442 CSelectionCriteria* getSelectionCriteria();
443 const CSelectionCriteria* getConstSelectionCriteria();
444
445 // System Class
446 CSystemClass* getSystemClass();
447 const CSystemClass* getConstSystemClass() const;
448
449 // Configurable Domains
450 CConfigurableDomains* getConfigurableDomains();
451 const CConfigurableDomains* getConstConfigurableDomains();
452 const CConfigurableDomains* getConstConfigurableDomains() const;
453
Guillaume Denneulinf2fd15a2012-12-20 17:53:29 +0100454 // Apply configurations
455 void doApplyConfigurations(bool bForce);
456
Patrick Benavoli68a91282011-08-31 11:23:23 +0200457 // Dynamic object creation libraries feeding
458 void feedElementLibraries();
459
460 // Remote Processor Server connection handling
461 bool handleRemoteProcessingInterface(string& strError);
462
463 // Back synchronization
Kevin Rocardace81f82012-12-11 16:19:17 +0100464 CBackSynchronizer* createBackSynchronizer() const;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200465
466 // Tuning
467 bool _bTuningModeIsOn;
468
469 // Value Space
470 bool _bValueSpaceIsRaw;
471
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200472 // Output Raw Format
473 bool _bOutputRawFormatIsHex;
474
Patrick Benavoli68a91282011-08-31 11:23:23 +0200475 // Automatic synchronization to HW during Tuning session
476 bool _bAutoSyncOn;
477
478 // Current Parameter Settings
479 CParameterBlackboard* _pMainParameterBlackboard;
480
481 // Dynamic object creation
482 CElementLibrarySet* _pElementLibrarySet;
483
484 // XML parsing, object creation handling
Patrick Benavoli95ac0342011-11-07 20:32:51 +0100485 string _strXmlConfigurationFilePath; // Configuration file path
486 string _strXmlConfigurationFolderPath; // Root folder for configuration file
Patrick Benavoli68a91282011-08-31 11:23:23 +0200487 string _strSchemaFolderLocation; // Place where schemas stand
488
489 // Subsystem plugin location
Guillaume Denneulina4ec15d2012-02-17 14:38:14 +0100490 const CSubsystemPlugins* _pSubsystemPlugins;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200491
Renaud de Chivre1b8b3ca2013-12-13 15:09:44 +0100492 // Remote processor library handle
493 void *_handleLibRemoteProcessor;
494
Patrick Benavoli68a91282011-08-31 11:23:23 +0200495 // Whole system structure checksum
496 uint8_t _uiStructureChecksum;
497
Patrick Benavoli63499d42011-10-24 18:50:03 +0200498 // Command Handler
499 CCommandHandler* _pCommandHandler;
500
Patrick Benavoli68a91282011-08-31 11:23:23 +0200501 // Remote Processor Server
502 IRemoteProcessorServerInterface* _pRemoteProcessorServer;
503
504 // Parser description array
Patrick Benavoli592ae562011-09-05 16:53:58 +0200505 static const SRemoteCommandParserItem gastRemoteCommandParserItems[];
Patrick Benavoli68a91282011-08-31 11:23:23 +0200506
507 // Parser description array size
508 static const uint32_t guiNbRemoteCommandParserItems;
509
510 // Maximum command usage length
511 uint32_t _uiMaxCommandUsageLength;
512
Patrick Benavoli065264a2011-11-20 15:46:41 +0100513 // Blackboard access mutex
514 pthread_mutex_t _blackboardMutex;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200515
516 // Logging
517 ILogger* _pLogger;
Patrick Benavoli592ae562011-09-05 16:53:58 +0200518 mutable uint32_t _uiLogDepth;
Kevin Rocardecf93102013-07-10 18:28:10 +0200519
520 /** If set to true, missing subsystem will abort parameterMgr start.
521 * If set to false, missing subsystem will fallback on virtual subsystem.
522 */
523 bool _bFailOnMissingSubsystem;
Kevin Rocardd6909eb2013-07-18 09:13:51 +0200524 /** If set to true, unparsable or discording domains will abort parameterMgr start.
525 * If set to false, unparsable or discording domains
526 * will continue the parameterMgr start with no domains.
527 */
528 bool _bFailOnFailedSettingsLoad;
Mattijs Korpershoekcce85f62014-04-08 14:10:03 +0200529
530 /**
531 * If set to true, parameterMgr will report an error
532 * when being unable to validate .xml files
533 * If set to false, no .xml/xsd validation will happen (default behaviour)
534 */
535 bool _bValidateSchemasOnStart;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200536};
537