|
2
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
* This component and the accompanying materials are made available
|
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
|
6 |
* which accompanies this distribution, and is available
|
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
|
8 |
*
|
|
|
9 |
* Initial Contributors:
|
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
|
11 |
*
|
|
|
12 |
* Contributors:
|
|
|
13 |
*
|
|
|
14 |
* Description: This module contains implementation of CSettingServer
|
|
|
15 |
* class member functions.
|
|
|
16 |
*
|
|
|
17 |
*/
|
|
|
18 |
|
|
|
19 |
// INCLUDE FILES
|
|
|
20 |
#include <e32std.h>
|
|
|
21 |
#include <e32svr.h>
|
|
|
22 |
|
|
|
23 |
#include "SettingServerClient.h"
|
|
|
24 |
#include "SettingServer.h"
|
|
|
25 |
|
|
|
26 |
#include <StifParser.h>
|
|
|
27 |
#include "STIFTestFrameworkSettings.h"
|
|
|
28 |
|
|
|
29 |
#include "Logging.h"
|
|
|
30 |
#include "TestEngineUtils.h"
|
|
|
31 |
|
|
|
32 |
// EXTERNAL DATA STRUCTURES
|
|
|
33 |
|
|
|
34 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
|
35 |
|
|
|
36 |
// CONSTANTS
|
|
|
37 |
|
|
|
38 |
// MACROS
|
|
|
39 |
|
|
|
40 |
// LOCAL CONSTANTS AND MACROS
|
|
|
41 |
|
|
|
42 |
// MODULE DATA STRUCTURES
|
|
|
43 |
|
|
|
44 |
// LOCAL FUNCTION PROTOTYPES
|
|
|
45 |
|
|
|
46 |
// FORWARD DECLARATIONS
|
|
|
47 |
|
|
|
48 |
// ==================== LOCAL FUNCTIONS =======================================
|
|
|
49 |
|
|
|
50 |
// None
|
|
|
51 |
|
|
|
52 |
#undef LOGGER
|
|
|
53 |
#define LOGGER iSettingServer->Logger()
|
|
|
54 |
|
|
|
55 |
// ================= MEMBER FUNCTIONS =========================================
|
|
|
56 |
|
|
|
57 |
/*
|
|
|
58 |
-------------------------------------------------------------------------------
|
|
|
59 |
|
|
|
60 |
Class: CLoggerSetting
|
|
|
61 |
|
|
|
62 |
Method: NewL
|
|
|
63 |
|
|
|
64 |
Description: Create new CLoggerSetting (Setting server session)
|
|
|
65 |
|
|
|
66 |
Parameters: RThread& aClient: in: Handle to thread client
|
|
|
67 |
CSettingServer* aServer: in: Pointer to CSettingServer
|
|
|
68 |
|
|
|
69 |
Return Values: CLoggerSetting* Pointer to new CLoggerSetting
|
|
|
70 |
|
|
|
71 |
Errors/Exceptions: Leaves if memory allocation fails or ConstructL leaves.
|
|
|
72 |
|
|
|
73 |
Status: Proposal
|
|
|
74 |
|
|
|
75 |
-------------------------------------------------------------------------------
|
|
|
76 |
*/
|
|
|
77 |
CLoggerSetting* CLoggerSetting::NewL( CSettingServer* aServer )
|
|
|
78 |
{
|
|
|
79 |
CLoggerSetting* self=new( ELeave ) CLoggerSetting();
|
|
|
80 |
CleanupStack::PushL( self );
|
|
|
81 |
self->ConstructL( aServer );
|
|
|
82 |
CleanupStack::Pop();
|
|
|
83 |
return self;
|
|
|
84 |
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
/*
|
|
|
88 |
-------------------------------------------------------------------------------
|
|
|
89 |
|
|
|
90 |
Class: CLoggerSetting
|
|
|
91 |
|
|
|
92 |
Method: CLoggerSetting
|
|
|
93 |
|
|
|
94 |
Description: Constructor. Initialise base class.
|
|
|
95 |
|
|
|
96 |
Parameters: RThread& aClient: in: Handle to client
|
|
|
97 |
|
|
|
98 |
Return Values: None
|
|
|
99 |
|
|
|
100 |
Errors/Exceptions: None
|
|
|
101 |
|
|
|
102 |
Status: Proposal
|
|
|
103 |
|
|
|
104 |
-------------------------------------------------------------------------------
|
|
|
105 |
*/
|
|
|
106 |
CLoggerSetting::CLoggerSetting() :
|
|
|
107 |
CSession2()
|
|
|
108 |
{
|
|
|
109 |
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
/*
|
|
|
113 |
-------------------------------------------------------------------------------
|
|
|
114 |
|
|
|
115 |
Class: CLoggerSetting
|
|
|
116 |
|
|
|
117 |
Method: ~CLoggerSetting
|
|
|
118 |
|
|
|
119 |
Description: Destructor.
|
|
|
120 |
|
|
|
121 |
Parameters: None
|
|
|
122 |
|
|
|
123 |
Return Values: None
|
|
|
124 |
|
|
|
125 |
Errors/Exceptions: None
|
|
|
126 |
|
|
|
127 |
Status: Proposal
|
|
|
128 |
|
|
|
129 |
-------------------------------------------------------------------------------
|
|
|
130 |
*/
|
|
|
131 |
CLoggerSetting::~CLoggerSetting()
|
|
|
132 |
{
|
|
|
133 |
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
/*
|
|
|
137 |
-------------------------------------------------------------------------------
|
|
|
138 |
|
|
|
139 |
Class: CLoggerSetting
|
|
|
140 |
|
|
|
141 |
Method: ConstructL
|
|
|
142 |
|
|
|
143 |
Description: Second level constructor.
|
|
|
144 |
|
|
|
145 |
Parameters: CSettingServer* aServer: in: Server
|
|
|
146 |
|
|
|
147 |
Return Values: None
|
|
|
148 |
|
|
|
149 |
Errors/Exceptions: Leaves if base class CreateL leaves
|
|
|
150 |
|
|
|
151 |
Status: Proposal
|
|
|
152 |
|
|
|
153 |
-------------------------------------------------------------------------------
|
|
|
154 |
*/
|
|
|
155 |
void CLoggerSetting::ConstructL( CSettingServer* aServer )
|
|
|
156 |
{
|
|
|
157 |
// @spe __TRACE( KInit,( _L( "CLoggerSetting::ConstructL - constructing server session" ) ) );
|
|
|
158 |
iSettingServer = aServer;
|
|
|
159 |
|
|
|
160 |
// second-phase construct base class
|
|
|
161 |
//CSession2::CreateL();
|
|
|
162 |
|
|
|
163 |
// iSettingServer = aServer;
|
|
|
164 |
|
|
|
165 |
// Inform server class that session is opening.
|
|
|
166 |
iSettingServer->OpenSession();
|
|
|
167 |
|
|
|
168 |
__TRACE( KInit,( _L( "CLoggerSetting::ConstructL - constructing server session done" ) ) );
|
|
|
169 |
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
/*
|
|
|
173 |
-------------------------------------------------------------------------------
|
|
|
174 |
|
|
|
175 |
Class: CLoggerSetting
|
|
|
176 |
|
|
|
177 |
Method: PanicClient
|
|
|
178 |
|
|
|
179 |
Description: Panic clients.
|
|
|
180 |
|
|
|
181 |
Parameters: TInt aPanic: in: Panic code
|
|
|
182 |
|
|
|
183 |
Return Values: None
|
|
|
184 |
|
|
|
185 |
Errors/Exceptions: None
|
|
|
186 |
|
|
|
187 |
Status: Proposal
|
|
|
188 |
|
|
|
189 |
-------------------------------------------------------------------------------
|
|
|
190 |
*/
|
|
|
191 |
void CLoggerSetting::PanicClient( const TInt aPanic, const RMessage2& aMessage ) const
|
|
|
192 |
{
|
|
|
193 |
__TRACE( KError,( _L( "CLoggerSetting::PanicClient code = %d" ), aPanic ) );
|
|
|
194 |
|
|
|
195 |
_LIT( KTxtModule,"CLoggerSetting" );
|
|
|
196 |
|
|
|
197 |
aMessage.Panic( KTxtModule,aPanic );
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
/*
|
|
|
201 |
-------------------------------------------------------------------------------
|
|
|
202 |
|
|
|
203 |
Class: CLoggerSetting
|
|
|
204 |
|
|
|
205 |
Method: CloseSession
|
|
|
206 |
|
|
|
207 |
Description: Close session
|
|
|
208 |
|
|
|
209 |
Parameters: const RMessage&: out: Message to be completed.
|
|
|
210 |
|
|
|
211 |
Return Values: TInt: Always KErrNone
|
|
|
212 |
|
|
|
213 |
Errors/Exceptions: None
|
|
|
214 |
|
|
|
215 |
Status: Proposal
|
|
|
216 |
|
|
|
217 |
-------------------------------------------------------------------------------
|
|
|
218 |
*/
|
|
|
219 |
TInt CLoggerSetting::CloseSession( /*const RMessage& aMessage*/ )
|
|
|
220 |
{
|
|
|
221 |
__TRACE( KVerbose,( _L( "CLoggerSetting::CloseSession in" ) ) );
|
|
|
222 |
|
|
|
223 |
// Close session from server (and stop it if required)
|
|
|
224 |
iSettingServer->CloseSession();
|
|
|
225 |
|
|
|
226 |
// NOTE: This complete will make after DispatchMessageL in ServiceL method.
|
|
|
227 |
// Complete message. This must be done after possible closing
|
|
|
228 |
// of the server to make sure that server is first closed before
|
|
|
229 |
// client can send new messages.
|
|
|
230 |
// aMessage.Complete( KErrNone );
|
|
|
231 |
|
|
|
232 |
__TRACE( KVerbose,( _L( "CLoggerSetting::CloseSession out" ) ) );
|
|
|
233 |
|
|
|
234 |
return KErrNone;
|
|
|
235 |
|
|
|
236 |
}
|
|
|
237 |
|
|
|
238 |
/*
|
|
|
239 |
-------------------------------------------------------------------------------
|
|
|
240 |
|
|
|
241 |
Class: CLoggerSetting
|
|
|
242 |
|
|
|
243 |
Method: ServiceL
|
|
|
244 |
|
|
|
245 |
Description: Trap harness for dispatcher
|
|
|
246 |
|
|
|
247 |
Parameters: const RMessage& aMessage: inout: Message
|
|
|
248 |
|
|
|
249 |
Return Values: None
|
|
|
250 |
|
|
|
251 |
Errors/Exceptions: None
|
|
|
252 |
|
|
|
253 |
Status: Proposal
|
|
|
254 |
|
|
|
255 |
-------------------------------------------------------------------------------
|
|
|
256 |
*/
|
|
|
257 |
void CLoggerSetting::ServiceL( const RMessage2& aMessage )
|
|
|
258 |
{
|
|
|
259 |
__TRACE( KVerbose,( _L( "CLoggerSetting::ServiceL in" ) ) );
|
|
|
260 |
|
|
|
261 |
TInt r( KErrNone );
|
|
|
262 |
TBool isMessageSync( EFalse );
|
|
|
263 |
|
|
|
264 |
TRAPD( ret, r = DispatchMessageL( aMessage, isMessageSync ) );
|
|
|
265 |
|
|
|
266 |
if( ret != KErrNone )
|
|
|
267 |
{
|
|
|
268 |
// Complete message on leaving cases with leave code allways.
|
|
|
269 |
__TRACE( KError,( _L( "CLoggerSetting::DispatchMessageL leaved" ) ) );
|
|
|
270 |
aMessage.Complete( ret );
|
|
|
271 |
}
|
|
|
272 |
else if( isMessageSync )
|
|
|
273 |
{
|
|
|
274 |
// Message is syncronous, Complete message with error code
|
|
|
275 |
// originating from message handling
|
|
|
276 |
__TRACE( KVerbose,( _L( "CLoggerSetting::DispatchMessageL completed with: %d" ), r ) );
|
|
|
277 |
aMessage.Complete( r );
|
|
|
278 |
}
|
|
|
279 |
__TRACE( KVerbose,( _L( "CLoggerSetting::ServiceL out" ) ) );
|
|
|
280 |
|
|
|
281 |
}
|
|
|
282 |
|
|
|
283 |
/*
|
|
|
284 |
-------------------------------------------------------------------------------
|
|
|
285 |
|
|
|
286 |
Class: CLoggerSetting
|
|
|
287 |
|
|
|
288 |
Method: DispatchMessageL
|
|
|
289 |
|
|
|
290 |
Description: Dispatch message, calls corresponding function to do it.
|
|
|
291 |
|
|
|
292 |
Parameters: const RMessage& aMessage: inout: Message to be handled
|
|
|
293 |
TBool& aIsMessageSync: inout: Indication of the message type
|
|
|
294 |
|
|
|
295 |
Return Values: TInt: Error code
|
|
|
296 |
|
|
|
297 |
Errors/Exceptions: Leaves if operation handling function leaves
|
|
|
298 |
|
|
|
299 |
Status: Proposal
|
|
|
300 |
|
|
|
301 |
-------------------------------------------------------------------------------
|
|
|
302 |
*/
|
|
|
303 |
TInt CLoggerSetting::DispatchMessageL( const RMessage2& aMessage,
|
|
|
304 |
TBool& aIsMessageSync )
|
|
|
305 |
{
|
|
|
306 |
__TRACE( KInit ,( _L( "CLoggerSetting::DispatchMessageL in" ) ) );
|
|
|
307 |
switch( aMessage.Function() )
|
|
|
308 |
{
|
|
|
309 |
case ESettingServerCloseSession:
|
|
|
310 |
{
|
|
|
311 |
__TRACE( KInit ,( _L( "Closing Setting server session" ) ) );
|
|
|
312 |
aIsMessageSync = ETrue;
|
|
|
313 |
return CloseSession( /*aMessage*/ );
|
|
|
314 |
}
|
|
|
315 |
case ELoadLoggerSettingsFromIniFile:
|
|
|
316 |
{
|
|
|
317 |
__TRACE( KInit ,( _L( "Read Logger setting(s) from initialization file" ) ) );
|
|
|
318 |
aIsMessageSync = ETrue;
|
|
|
319 |
return LoadLoggerSettingsFromIniFile( aMessage );
|
|
|
320 |
}
|
|
|
321 |
case ELoadLoggerSettingsFromCommandLine:
|
|
|
322 |
{
|
|
|
323 |
__TRACE( KInit ,( _L( "Read Logger setting(s) from command line" ) ) );
|
|
|
324 |
aIsMessageSync = ETrue;
|
|
|
325 |
return LoadLoggerSettingsFromCommandLine( aMessage );
|
|
|
326 |
}
|
|
|
327 |
case EGetLoggerSettings:
|
|
|
328 |
{
|
|
|
329 |
__TRACE( KInit ,( _L( "Get Logger setting(s)" ) ) );
|
|
|
330 |
aIsMessageSync = ETrue;
|
|
|
331 |
return GetLoggerSettings( aMessage );
|
|
|
332 |
}
|
|
|
333 |
case ESetLoggerOutputPath:
|
|
|
334 |
{
|
|
|
335 |
__TRACE( KInit ,( _L( "Set new initialization file setting" ) ) );
|
|
|
336 |
aIsMessageSync = ETrue;
|
|
|
337 |
return SetLoggerOutputPath( aMessage );
|
|
|
338 |
}
|
|
|
339 |
case EResetLoggerSettings:
|
|
|
340 |
{
|
|
|
341 |
__TRACE( KInit ,( _L( "Reset logger settings" ) ) );
|
|
|
342 |
aIsMessageSync = ETrue;
|
|
|
343 |
return ResetLoggerSettings( aMessage );
|
|
|
344 |
}
|
|
|
345 |
// Invalid request
|
|
|
346 |
default:
|
|
|
347 |
{
|
|
|
348 |
PanicClient( EBadRequest, aMessage );
|
|
|
349 |
return KErrNotSupported;
|
|
|
350 |
}
|
|
|
351 |
}
|
|
|
352 |
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
/*
|
|
|
356 |
-------------------------------------------------------------------------------
|
|
|
357 |
|
|
|
358 |
Class: CSettingServer
|
|
|
359 |
|
|
|
360 |
Method: ReadLoggerSettingsFromIniFile
|
|
|
361 |
|
|
|
362 |
Description: Read Logger setting from initialization file. Mainly use from
|
|
|
363 |
TestEngine side.
|
|
|
364 |
|
|
|
365 |
Parameters: const RMessage& aMessage: inout: Message to be handled
|
|
|
366 |
|
|
|
367 |
Return Values: TInt: Symbian error code
|
|
|
368 |
|
|
|
369 |
Errors/Exceptions: None
|
|
|
370 |
|
|
|
371 |
Status: Proposal
|
|
|
372 |
|
|
|
373 |
-------------------------------------------------------------------------------
|
|
|
374 |
*/
|
|
|
375 |
TInt CLoggerSetting::LoadLoggerSettingsFromIniFile( const RMessage2& aMessage )
|
|
|
376 |
{
|
|
|
377 |
__TRACE( KInit, ( _L( "CLoggerSetting::ReadLoggerSettingsFromIniFile" ) ) );
|
|
|
378 |
|
|
|
379 |
TInt overwritePreviousSettings = aMessage.Int2();
|
|
|
380 |
|
|
|
381 |
if ( overwritePreviousSettings || ( iSettingServer->iDefaultSettings ) )
|
|
|
382 |
{
|
|
|
383 |
// Get data from message
|
|
|
384 |
TFileName iniFile;
|
|
|
385 |
|
|
|
386 |
// Get length from message param 1
|
|
|
387 |
// Read data from client descriptor (param 0)
|
|
|
388 |
TRAPD( ret, aMessage.ReadL( 0, iniFile ) );
|
|
|
389 |
|
|
|
390 |
if ( ret != KErrNone )
|
|
|
391 |
{
|
|
|
392 |
PanicClient( EBadDescriptor, aMessage );
|
|
|
393 |
return KErrBadDescriptor;
|
|
|
394 |
}
|
|
|
395 |
|
|
|
396 |
// Inifile name and path information
|
|
|
397 |
iSettingServer->iIniFile = iniFile;
|
|
|
398 |
|
|
|
399 |
ret = ReadLoggerDefaults();
|
|
|
400 |
if( ret != KErrNone )
|
|
|
401 |
{
|
|
|
402 |
return ret;
|
|
|
403 |
}
|
|
|
404 |
}
|
|
|
405 |
|
|
|
406 |
// Copies logger settings to the package
|
|
|
407 |
TPckg<TLoggerSettings> loggerSettingsPckg( iSettingServer->iLoggerSettings );
|
|
|
408 |
|
|
|
409 |
// Writes a packege that includes the logger overwrite settings to aMessage
|
|
|
410 |
TRAPD( err, aMessage.WriteL( 1, loggerSettingsPckg ) );
|
|
|
411 |
|
|
|
412 |
if ( err != KErrNone )
|
|
|
413 |
{
|
|
|
414 |
PanicClient( EBadDescriptor, aMessage );
|
|
|
415 |
}
|
|
|
416 |
|
|
|
417 |
return KErrNone;
|
|
|
418 |
}
|
|
|
419 |
/*
|
|
|
420 |
-------------------------------------------------------------------------------
|
|
|
421 |
|
|
|
422 |
Class: CSettingServer
|
|
|
423 |
|
|
|
424 |
Method: ReadLoggerSettingsFromIniFile
|
|
|
425 |
|
|
|
426 |
Description: Read Logger setting from initialization file. Mainly use from
|
|
|
427 |
TestEngine side.
|
|
|
428 |
|
|
|
429 |
Parameters: const RMessage& aMessage: inout: Message to be handled
|
|
|
430 |
|
|
|
431 |
Return Values: TInt: Symbian error code
|
|
|
432 |
|
|
|
433 |
Errors/Exceptions: None
|
|
|
434 |
|
|
|
435 |
Status: Proposal
|
|
|
436 |
|
|
|
437 |
-------------------------------------------------------------------------------
|
|
|
438 |
*/
|
|
|
439 |
TInt CLoggerSetting::LoadLoggerSettingsFromCommandLine( const RMessage2& aMessage )
|
|
|
440 |
{
|
|
|
441 |
TBuf<256> logconfiguration;
|
|
|
442 |
aMessage.ReadL( 0, logconfiguration );
|
|
|
443 |
//iSettingServer->iLoggerSettings;
|
|
|
444 |
logconfiguration.TrimAll();
|
|
|
445 |
TInt i=0;
|
|
|
446 |
TLex lex(logconfiguration);
|
|
|
447 |
while ( !lex.Eos() )
|
|
|
448 |
{
|
|
|
449 |
TPtrC key=lex.NextToken();
|
|
|
450 |
i++;
|
|
|
451 |
TPtrC value=lex.NextToken();
|
|
|
452 |
i++;
|
|
|
453 |
if(key !=KNullDesC && value !=KNullDesC)
|
|
|
454 |
{
|
|
|
455 |
UpdateLoggerSettings(key,value);
|
|
|
456 |
|
|
|
457 |
}
|
|
|
458 |
|
|
|
459 |
}
|
|
|
460 |
return KErrNone;
|
|
|
461 |
}
|
|
|
462 |
TInt CLoggerSetting::UpdateLoggerSettings(TDesC& aKey,TDesC& aValue)
|
|
|
463 |
{
|
|
|
464 |
_LIT(KCreateLogDirectories,"CreateLogDirectories");
|
|
|
465 |
_LIT(KEmulatorBasePath,"EmulatorBasePath");
|
|
|
466 |
_LIT(KEmulatorFormat,"EmulatorFormat");
|
|
|
467 |
_LIT(KEmulatorOutput,"EmulatorOutput");
|
|
|
468 |
_LIT(KHardwareBasePath,"HardwareBasePath");
|
|
|
469 |
_LIT(KHardwareFormat,"HardwareFormat");
|
|
|
470 |
_LIT(KHardwareOutput,"HardwareOutput");
|
|
|
471 |
_LIT(KFileCreationMode,"FileCreationMode");
|
|
|
472 |
_LIT(KWithTimeStamp,"WithTimeStamp");
|
|
|
473 |
_LIT(KWithLineBreak,"WithLineBreak");
|
|
|
474 |
_LIT(KWithEventRanking,"WithEventRanking");
|
|
|
475 |
_LIT(KThreadIdToLogFile,"ThreadIdToLogFile");
|
|
|
476 |
_LIT(KFileUnicode,"FileUnicode");
|
|
|
477 |
_LIT(KAddTestCaseTitle,"AddTestCaseTitle");
|
|
|
478 |
if(aKey==KCreateLogDirectories)
|
|
|
479 |
{
|
|
|
480 |
if( aValue == _L( "NO" ) )
|
|
|
481 |
{
|
|
|
482 |
iSettingServer->iLoggerSettings.iCreateLogDirectories=EFalse;
|
|
|
483 |
}
|
|
|
484 |
else
|
|
|
485 |
{
|
|
|
486 |
iSettingServer->iLoggerSettings.iCreateLogDirectories=ETrue;
|
|
|
487 |
}
|
|
|
488 |
iSettingServer->iLoggerSettings.iIsDefined.iCreateLogDir = ETrue;
|
|
|
489 |
}
|
|
|
490 |
else if(aKey==KEmulatorBasePath)
|
|
|
491 |
{
|
|
|
492 |
iSettingServer->iLoggerSettings.iEmulatorPath = aValue;
|
|
|
493 |
iSettingServer->iLoggerSettings.iIsDefined.iPath = ETrue;
|
|
|
494 |
}
|
|
|
495 |
else if(aKey==KEmulatorFormat)
|
|
|
496 |
{
|
|
|
497 |
if( aValue == _L( "TXT" ) )
|
|
|
498 |
{
|
|
|
499 |
iSettingServer->iLoggerSettings.iEmulatorFormat = CStifLogger::ETxt;
|
|
|
500 |
}
|
|
|
501 |
else if( aValue == _L( "HTML" ) )
|
|
|
502 |
{
|
|
|
503 |
iSettingServer->iLoggerSettings.iEmulatorFormat = CStifLogger::EHtml;
|
|
|
504 |
}
|
|
|
505 |
else if( aValue == _L( "DATA" ) )
|
|
|
506 |
{
|
|
|
507 |
iSettingServer->iLoggerSettings.iEmulatorFormat = CStifLogger::EData;
|
|
|
508 |
}
|
|
|
509 |
else if( aValue == _L( "XML" ) )
|
|
|
510 |
{
|
|
|
511 |
iSettingServer->iLoggerSettings.iEmulatorFormat = CStifLogger::ETxt;
|
|
|
512 |
|
|
|
513 |
}
|
|
|
514 |
|
|
|
515 |
iSettingServer->iLoggerSettings.iIsDefined.iFormat = ETrue;
|
|
|
516 |
}
|
|
|
517 |
else if(aKey==KEmulatorOutput)
|
|
|
518 |
{
|
|
|
519 |
|
|
|
520 |
if( aValue == _L( "FILE" ) )
|
|
|
521 |
{
|
|
|
522 |
iSettingServer->iLoggerSettings.iEmulatorOutput = CStifLogger::EFile;
|
|
|
523 |
}
|
|
|
524 |
else if( aValue == _L( "RDEBUG" ) )
|
|
|
525 |
{
|
|
|
526 |
iSettingServer->iLoggerSettings.iEmulatorOutput = CStifLogger::ERDebug;
|
|
|
527 |
}
|
|
|
528 |
iSettingServer->iLoggerSettings.iIsDefined.iOutput = ETrue;
|
|
|
529 |
}
|
|
|
530 |
else if(aKey==KHardwareBasePath)
|
|
|
531 |
{
|
|
|
532 |
iSettingServer->iLoggerSettings.iHardwarePath = aValue;
|
|
|
533 |
iSettingServer->iLoggerSettings.iIsDefined.iOutput = ETrue;
|
|
|
534 |
}
|
|
|
535 |
else if(aKey==KHardwareFormat)
|
|
|
536 |
{
|
|
|
537 |
|
|
|
538 |
if( aValue == _L( "TXT" ) )
|
|
|
539 |
{
|
|
|
540 |
iSettingServer->iLoggerSettings.iHardwareFormat = CStifLogger::ETxt;
|
|
|
541 |
}
|
|
|
542 |
else if( aValue == _L( "HTML" ) )
|
|
|
543 |
{
|
|
|
544 |
iSettingServer->iLoggerSettings.iHardwareFormat = CStifLogger::EHtml;
|
|
|
545 |
}
|
|
|
546 |
else if( aValue == _L( "DATA" ) )
|
|
|
547 |
{
|
|
|
548 |
iSettingServer->iLoggerSettings.iHardwareFormat = CStifLogger::EData;
|
|
|
549 |
}
|
|
|
550 |
else if( aValue == _L( "XML" ) )
|
|
|
551 |
{
|
|
|
552 |
iSettingServer->iLoggerSettings.iHardwareFormat = CStifLogger::ETxt;
|
|
|
553 |
|
|
|
554 |
}
|
|
|
555 |
iSettingServer->iLoggerSettings.iIsDefined.iHwFormat = ETrue;
|
|
|
556 |
}
|
|
|
557 |
else if(aKey==KHardwareOutput)
|
|
|
558 |
{
|
|
|
559 |
if( aValue == _L( "FILE" ) )
|
|
|
560 |
{
|
|
|
561 |
iSettingServer->iLoggerSettings.iHardwareOutput = CStifLogger::EFile;
|
|
|
562 |
}
|
|
|
563 |
else if( aValue == _L( "RDEBUG" ) )
|
|
|
564 |
{
|
|
|
565 |
iSettingServer->iLoggerSettings.iHardwareOutput = CStifLogger::ERDebug;
|
|
|
566 |
}
|
|
|
567 |
iSettingServer->iLoggerSettings.iIsDefined.iHwOutput = ETrue;
|
|
|
568 |
}
|
|
|
569 |
else if(aKey==KFileCreationMode)
|
|
|
570 |
{
|
|
|
571 |
if( aValue == _L( "APPEND" ) )
|
|
|
572 |
{
|
|
|
573 |
iSettingServer->iLoggerSettings.iOverwrite = EFalse;
|
|
|
574 |
}
|
|
|
575 |
else if( aValue == _L( "OVERWRITE") )
|
|
|
576 |
{
|
|
|
577 |
iSettingServer->iLoggerSettings.iOverwrite = ETrue;
|
|
|
578 |
}
|
|
|
579 |
iSettingServer->iLoggerSettings.iIsDefined.iOverwrite = ETrue;
|
|
|
580 |
}
|
|
|
581 |
else if(aKey==KWithTimeStamp)
|
|
|
582 |
{
|
|
|
583 |
|
|
|
584 |
if( aValue == _L( "NO" ) )
|
|
|
585 |
{
|
|
|
586 |
iSettingServer->iLoggerSettings.iTimeStamp = EFalse;
|
|
|
587 |
}
|
|
|
588 |
|
|
|
589 |
else if( aValue == _L( "YES" ) )
|
|
|
590 |
{
|
|
|
591 |
iSettingServer->iLoggerSettings.iTimeStamp = ETrue;
|
|
|
592 |
}
|
|
|
593 |
iSettingServer->iLoggerSettings.iIsDefined.iTimeStamp = ETrue;
|
|
|
594 |
}
|
|
|
595 |
else if(aKey==KWithLineBreak)
|
|
|
596 |
{
|
|
|
597 |
if( aValue == _L( "NO" ) )
|
|
|
598 |
{
|
|
|
599 |
iSettingServer->iLoggerSettings.iLineBreak = EFalse;
|
|
|
600 |
}
|
|
|
601 |
|
|
|
602 |
else if( aValue == _L( "YES" ) )
|
|
|
603 |
{
|
|
|
604 |
iSettingServer->iLoggerSettings.iLineBreak = ETrue;
|
|
|
605 |
}
|
|
|
606 |
iSettingServer->iLoggerSettings.iIsDefined.iLineBreak = ETrue;
|
|
|
607 |
}
|
|
|
608 |
else if(aKey==KWithEventRanking)
|
|
|
609 |
{
|
|
|
610 |
if( aValue == _L( "NO" ) )
|
|
|
611 |
{
|
|
|
612 |
iSettingServer->iLoggerSettings.iEventRanking = EFalse;
|
|
|
613 |
}
|
|
|
614 |
|
|
|
615 |
else if( aValue == _L( "YES" ) )
|
|
|
616 |
{
|
|
|
617 |
iSettingServer->iLoggerSettings.iEventRanking = ETrue;
|
|
|
618 |
}
|
|
|
619 |
iSettingServer->iLoggerSettings.iIsDefined.iEventRanking = ETrue;
|
|
|
620 |
}
|
|
|
621 |
else if(aKey==KThreadIdToLogFile)
|
|
|
622 |
{
|
|
|
623 |
if( aValue == _L( "NO" ) )
|
|
|
624 |
{
|
|
|
625 |
iSettingServer->iLoggerSettings.iThreadId = EFalse;
|
|
|
626 |
}
|
|
|
627 |
|
|
|
628 |
else if( aValue == _L( "YES" ) )
|
|
|
629 |
{
|
|
|
630 |
iSettingServer->iLoggerSettings.iThreadId = ETrue;
|
|
|
631 |
}
|
|
|
632 |
iSettingServer->iLoggerSettings.iIsDefined.iThreadId = ETrue;
|
|
|
633 |
}
|
|
|
634 |
else if(aKey==KFileUnicode)
|
|
|
635 |
{
|
|
|
636 |
if( aValue == _L( "NO" ) )
|
|
|
637 |
{
|
|
|
638 |
iSettingServer->iLoggerSettings.iUnicode = EFalse;
|
|
|
639 |
}
|
|
|
640 |
|
|
|
641 |
else if( aValue == _L( "YES" ) )
|
|
|
642 |
{
|
|
|
643 |
iSettingServer->iLoggerSettings.iUnicode = ETrue;
|
|
|
644 |
}
|
|
|
645 |
iSettingServer->iLoggerSettings.iIsDefined.iUnicode = ETrue;
|
|
|
646 |
}
|
|
|
647 |
else if(aKey==KAddTestCaseTitle)
|
|
|
648 |
{
|
|
|
649 |
if( aValue == _L( "NO" ) )
|
|
|
650 |
{
|
|
|
651 |
iSettingServer->iLoggerSettings.iAddTestCaseTitle = EFalse;
|
|
|
652 |
}
|
|
|
653 |
|
|
|
654 |
else if( aValue == _L( "YES" ) )
|
|
|
655 |
{
|
|
|
656 |
iSettingServer->iLoggerSettings.iAddTestCaseTitle = ETrue;
|
|
|
657 |
}
|
|
|
658 |
iSettingServer->iLoggerSettings.iIsDefined.iAddTestCaseTitle = ETrue;
|
|
|
659 |
}
|
|
|
660 |
|
|
|
661 |
|
|
|
662 |
return KErrNone;
|
|
|
663 |
}
|
|
|
664 |
/*
|
|
|
665 |
-------------------------------------------------------------------------------
|
|
|
666 |
|
|
|
667 |
Class: CLoggerSetting
|
|
|
668 |
|
|
|
669 |
Method: ReadLoggerDefaults
|
|
|
670 |
|
|
|
671 |
Description: Parse Logger defaults from STIF initialization
|
|
|
672 |
file.
|
|
|
673 |
|
|
|
674 |
Parameters: None
|
|
|
675 |
|
|
|
676 |
Return Values: TInt: Return Symbian error code
|
|
|
677 |
|
|
|
678 |
Errors/Exceptions: None
|
|
|
679 |
|
|
|
680 |
Status: Proposal
|
|
|
681 |
|
|
|
682 |
-------------------------------------------------------------------------------
|
|
|
683 |
*/
|
|
|
684 |
TInt CLoggerSetting::ReadLoggerDefaults()
|
|
|
685 |
{
|
|
|
686 |
__TRACE( KInit,( _L( "" ) ) );
|
|
|
687 |
__TRACE( KInit,( _L( "CLoggerSetting::ReadLoggerDefaults" ) ) );
|
|
|
688 |
__TRACE( KInit,( _L( "Start reading and parsing Logger defaults" ) ) );
|
|
|
689 |
|
|
|
690 |
TInt ret = KErrNone;
|
|
|
691 |
|
|
|
692 |
// Create parser for parsing ini file
|
|
|
693 |
CStifParser* parser = NULL;
|
|
|
694 |
TRAPD( r, parser = CStifParser::NewL( _L(""), iSettingServer->iIniFile ) );
|
|
|
695 |
if ( r != KErrNone )
|
|
|
696 |
{
|
|
|
697 |
__TRACE( KError,( CStifLogger::ERed, _L( "Can't open ini-file [%S], code %d" ), &iSettingServer->iIniFile, r ) );
|
|
|
698 |
return r;
|
|
|
699 |
}
|
|
|
700 |
|
|
|
701 |
TTestEngineUtils::ParseLoggerDefaults( parser, iSettingServer->iLoggerSettings, LOGGER );
|
|
|
702 |
|
|
|
703 |
delete parser;
|
|
|
704 |
|
|
|
705 |
return ret;
|
|
|
706 |
}
|
|
|
707 |
|
|
|
708 |
/*
|
|
|
709 |
-------------------------------------------------------------------------------
|
|
|
710 |
|
|
|
711 |
Class: CSettingServer
|
|
|
712 |
|
|
|
713 |
Method: GetLoggerSettings
|
|
|
714 |
|
|
|
715 |
Description: Get Logger settings. Mainly use from Logger side.
|
|
|
716 |
|
|
|
717 |
If there are not any active sessions, then stop active scheduler and
|
|
|
718 |
close whole server.
|
|
|
719 |
|
|
|
720 |
Parameters: None
|
|
|
721 |
|
|
|
722 |
Return Values: TInt: Symbian error code
|
|
|
723 |
|
|
|
724 |
Errors/Exceptions: None
|
|
|
725 |
|
|
|
726 |
Status: Proposal
|
|
|
727 |
|
|
|
728 |
-------------------------------------------------------------------------------
|
|
|
729 |
*/
|
|
|
730 |
TInt CLoggerSetting::GetLoggerSettings( const RMessage2& aMessage )
|
|
|
731 |
{
|
|
|
732 |
__TRACE( KInit, ( _L( "CLoggerSetting::GetLoggerSettings in" ) ) );
|
|
|
733 |
|
|
|
734 |
// Copies logger settings to the package
|
|
|
735 |
TPckg<TLoggerSettings> loggerSettingsPckg( iSettingServer->iLoggerSettings );
|
|
|
736 |
|
|
|
737 |
// Writes a packege that includes the logger overwrite settings to aMessage
|
|
|
738 |
TRAPD( err, aMessage.WriteL( 0, loggerSettingsPckg ) );
|
|
|
739 |
|
|
|
740 |
if ( err != KErrNone )
|
|
|
741 |
{
|
|
|
742 |
PanicClient( EBadDescriptor, aMessage );
|
|
|
743 |
}
|
|
|
744 |
|
|
|
745 |
__TRACE( KInit, ( _L( "CLoggerSetting::GetLoggerSettings out" ) ) );
|
|
|
746 |
|
|
|
747 |
return KErrNone;
|
|
|
748 |
|
|
|
749 |
}
|
|
|
750 |
|
|
|
751 |
/*
|
|
|
752 |
-------------------------------------------------------------------------------
|
|
|
753 |
|
|
|
754 |
Class: CSettingServer
|
|
|
755 |
|
|
|
756 |
Method: SetNewIniFileSetting
|
|
|
757 |
|
|
|
758 |
Description: Set new initialization file settings to WINS and HW platforms.
|
|
|
759 |
|
|
|
760 |
Parameters: None
|
|
|
761 |
|
|
|
762 |
Return Values: TInt: Symbian error code
|
|
|
763 |
|
|
|
764 |
Errors/Exceptions: None
|
|
|
765 |
|
|
|
766 |
Status: Proposal
|
|
|
767 |
|
|
|
768 |
-------------------------------------------------------------------------------
|
|
|
769 |
*/
|
|
|
770 |
TInt CLoggerSetting::SetLoggerOutputPath( const RMessage2& aMessage )
|
|
|
771 |
{
|
|
|
772 |
__TRACE( KInit, ( _L( "CLoggerSetting::SetNewIniFileSetting" ) ) );
|
|
|
773 |
|
|
|
774 |
TInt ret( 0 );
|
|
|
775 |
|
|
|
776 |
TName loggerOutputPath;
|
|
|
777 |
// Get data from message
|
|
|
778 |
// NOTE! If message length is over TName, ReadL will cut the message
|
|
|
779 |
// to allowed size and won't return any error code or leave code.
|
|
|
780 |
TRAP( ret, aMessage.ReadL( 0, loggerOutputPath ) );
|
|
|
781 |
|
|
|
782 |
if ( ret != KErrNone )
|
|
|
783 |
{
|
|
|
784 |
PanicClient( EBadDescriptor, aMessage );
|
|
|
785 |
return KErrBadDescriptor;
|
|
|
786 |
}
|
|
|
787 |
|
|
|
788 |
iSettingServer->iLoggerSettings.iEmulatorPath = loggerOutputPath;
|
|
|
789 |
iSettingServer->iLoggerSettings.iIsDefined.iPath = ETrue;
|
|
|
790 |
iSettingServer->iLoggerSettings.iHardwarePath = loggerOutputPath;
|
|
|
791 |
iSettingServer->iLoggerSettings.iIsDefined.iHwPath = ETrue;
|
|
|
792 |
|
|
|
793 |
__TRACE( KInit, ( _L( "New emulator and hardware path: [%S]" ), &loggerOutputPath ) );
|
|
|
794 |
|
|
|
795 |
return KErrNone;
|
|
|
796 |
}
|
|
|
797 |
|
|
|
798 |
TInt CLoggerSetting::ResetLoggerSettings( const RMessage2& aMessage )
|
|
|
799 |
{
|
|
|
800 |
__TRACE( KInit, ( _L( "CLoggerSetting::ResetLoggerSettings" ) ) );
|
|
|
801 |
|
|
|
802 |
iSettingServer->ResetLoggerSettings();
|
|
|
803 |
return KErrNone;
|
|
|
804 |
}
|
|
|
805 |
|
|
|
806 |
// End of File
|