os/persistentdata/loggingservices/eventlogger/LogCli/src/LOGCLI.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
// System includes
sl@0
    17
#include <bautils.h>
sl@0
    18
#include <barsc2.h> // For CResourceFile
sl@0
    19
#include <barsread2.h> // For RResourceReader
sl@0
    20
#include <logwrap.h>
sl@0
    21
sl@0
    22
// User includes
sl@0
    23
#include <logcli.h>
sl@0
    24
#include "logservcli.h"
sl@0
    25
#include "LogServShared.h"
sl@0
    26
#include "logpackage.h"
sl@0
    27
#include "logclipanic.h"
sl@0
    28
#include "logclientop.h"
sl@0
    29
#include "LogClientObserver.h"
sl@0
    30
sl@0
    31
//**********************************
sl@0
    32
// TLogConfig
sl@0
    33
//**********************************
sl@0
    34
sl@0
    35
/** Sets the:
sl@0
    36
sl@0
    37
maximum age of events to zero
sl@0
    38
sl@0
    39
maximum number of events to appear in the log to zero
sl@0
    40
sl@0
    41
maximum number of events to appear in a recent event list to zero */
sl@0
    42
EXPORT_C TLogConfig::TLogConfig()
sl@0
    43
: iMaxLogSize(0), iMaxRecentLogSize(0), iMaxEventAge(0)
sl@0
    44
	{
sl@0
    45
	}
sl@0
    46
sl@0
    47
void TLogConfig::InternalizeL(RReadStream& aStream)
sl@0
    48
	{
sl@0
    49
	aStream >> iMaxLogSize;
sl@0
    50
	aStream >> iMaxRecentLogSize;
sl@0
    51
	aStream >> iMaxEventAge;
sl@0
    52
	}
sl@0
    53
sl@0
    54
void TLogConfig::ExternalizeL(RWriteStream& aStream) const
sl@0
    55
	{
sl@0
    56
	aStream << iMaxLogSize;
sl@0
    57
	aStream << iMaxRecentLogSize;
sl@0
    58
	aStream << iMaxEventAge;
sl@0
    59
	}
sl@0
    60
sl@0
    61
//**********************************
sl@0
    62
// CLogClient
sl@0
    63
//**********************************
sl@0
    64
sl@0
    65
EXPORT_C CLogClient* CLogClient::NewL(RFs& aFs, TInt aPriority/* = CActive::EPriorityStandard*/)
sl@0
    66
	{
sl@0
    67
	CLogClient* self = new(ELeave)CLogClient(aFs, aPriority);
sl@0
    68
	CleanupStack::PushL(self);
sl@0
    69
	self->ConstructL();
sl@0
    70
	CleanupStack::Pop(); // self
sl@0
    71
	return self;
sl@0
    72
	}
sl@0
    73
sl@0
    74
void CLogClient::ConstructL()
sl@0
    75
	{
sl@0
    76
	// Load resources
sl@0
    77
	LoadResourcesL(iFs);
sl@0
    78
sl@0
    79
	iSession = new(ELeave)RLogSession;
sl@0
    80
	User::LeaveIfError(iSession->Connect());
sl@0
    81
	iPackage = CLogPackage::NewL();
sl@0
    82
sl@0
    83
	iAddEvent = new(ELeave)CLogAddEventClientOp(*iSession, *iPackage, Priority());
sl@0
    84
	iChangeEvent = new(ELeave)CLogChangeEventClientOp(*iSession, *iPackage, Priority());
sl@0
    85
	iGetEvent = new(ELeave)CLogGetEventClientOp(*iSession, *iPackage, Priority());
sl@0
    86
	iDeleteEvent = new(ELeave)CLogDeleteEventClientOp(*iSession, *iPackage, Priority());
sl@0
    87
	iAddType = new(ELeave)CLogAddTypeClientOp(*iSession, *iPackage, Priority());
sl@0
    88
	iChangeType = new(ELeave)CLogChangeTypeClientOp(*iSession, *iPackage, Priority());
sl@0
    89
	iGetType = new(ELeave)CLogGetTypeClientOp(*iSession, *iPackage, Priority());
sl@0
    90
	iDeleteType = new(ELeave)CLogDeleteTypeClientOp(*iSession, *iPackage, Priority());
sl@0
    91
	iGetConfig = new(ELeave)CLogGetConfigClientOp(*iSession, *iPackage, Priority());
sl@0
    92
	iChangeConfig = new(ELeave)CLogChangeConfigClientOp(*iSession, *iPackage, Priority());
sl@0
    93
	iClearLog = new(ELeave)CLogClearLogClientOp(*iSession, *iPackage, Priority());
sl@0
    94
	iClearRecent = new(ELeave)CLogClearRecentClientOp(*iSession, *iPackage, Priority());
sl@0
    95
	}
sl@0
    96
sl@0
    97
/** Frees all resources owned by the Log Engine object prior to its destruction. 
sl@0
    98
In particular, any outstanding asynchronous request is cancelled, the database, 
sl@0
    99
the database session and the resource file are all closed. */
sl@0
   100
EXPORT_C CLogClient::~CLogClient()
sl@0
   101
	{
sl@0
   102
	Cancel();
sl@0
   103
sl@0
   104
	delete iChangeObserver;
sl@0
   105
	if (iSession && iSession->Handle())
sl@0
   106
		{
sl@0
   107
		// Complete change notification
sl@0
   108
		NotifyChangeCancel();
sl@0
   109
		iSession->Close();
sl@0
   110
		}
sl@0
   111
sl@0
   112
	delete iSession;
sl@0
   113
	delete iPackage;
sl@0
   114
	delete iAddEvent;
sl@0
   115
	delete iChangeEvent;
sl@0
   116
	delete iGetEvent;
sl@0
   117
	delete iDeleteEvent;
sl@0
   118
	delete iAddType;
sl@0
   119
	delete iChangeType;
sl@0
   120
	delete iGetType;
sl@0
   121
	delete iDeleteType;
sl@0
   122
	delete iGetConfig;
sl@0
   123
	delete iChangeConfig;
sl@0
   124
	delete iClearLog;
sl@0
   125
	delete iClearRecent;
sl@0
   126
	}
sl@0
   127
sl@0
   128
CLogClient::CLogClient(RFs& aFs, TInt aPriority)
sl@0
   129
: CLogBase(aPriority), iFs(aFs)
sl@0
   130
	{
sl@0
   131
	}
sl@0
   132
sl@0
   133
/** Adds an event to the log database. This is an asynchronous request.
sl@0
   134
sl@0
   135
There must be no asynchronous request outstanding when this function is called, 
sl@0
   136
otherwise the function raises a LogCli 0 panic.
sl@0
   137
sl@0
   138
@param aEvent A log event detail object containing the attributes of the event 
sl@0
   139
to be added. The Log Engine sets the unique event ID, the UTC time and the event 
sl@0
   140
description, replacing any supplied values. The caller must ensure that this 
sl@0
   141
object remains in existence and valid until the request is complete.
sl@0
   142
@param aStatus The request status. On request completion,contains: KErrNone, 
sl@0
   143
if the event has been successfully added to the log database; KErrNotFound, 
sl@0
   144
if the event type is not registered with the Log Engine; KErrNotSupported, 
sl@0
   145
if the logging of events of this type has been disabled; otherwise, one of 
sl@0
   146
the other system wide error codes.
sl@0
   147
@capability Note For built-in event types, the required capability level is defined in
sl@0
   148
the event type's write access policy.
sl@0
   149
@see CLogEventType::SetLoggingEnabled() */
sl@0
   150
EXPORT_C void CLogClient::AddEvent(CLogEvent& aEvent, TRequestStatus& aStatus)
sl@0
   151
	{
sl@0
   152
	Queue(aStatus);
sl@0
   153
	iAddEvent->Start(aEvent, iStatus);
sl@0
   154
	SetActive();
sl@0
   155
	}
sl@0
   156
sl@0
   157
/** Changes the details of an existing event. This is an asynchronous request.
sl@0
   158
sl@0
   159
There must be no asynchronous request outstanding when this function is called, 
sl@0
   160
otherwise the function raises a LogCli 0 panic.
sl@0
   161
sl@0
   162
Note that it is not possible to change the event type using this function.
sl@0
   163
sl@0
   164
@param aEvent The event detail object containing the attributes of the event 
sl@0
   165
to be changed. Before calling the function, this object must contain the appropriate 
sl@0
   166
unique event ID; if no unique event ID is set, the function raises a LogCli 
sl@0
   167
13 panic. The caller must ensure that this object remains in existence and 
sl@0
   168
valid until the request is complete.
sl@0
   169
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   170
if successful; otherwise, one of the other system wide error codes.
sl@0
   171
@capability Note For built-in event types, the required capability level is defined in
sl@0
   172
the event type's write access policy.
sl@0
   173
@see TLogId */
sl@0
   174
EXPORT_C void CLogClient::ChangeEvent(const CLogEvent& aEvent, TRequestStatus& aStatus)
sl@0
   175
	{
sl@0
   176
	Queue(aStatus);
sl@0
   177
	iChangeEvent->Start(aEvent, iStatus);
sl@0
   178
	SetActive();
sl@0
   179
	}
sl@0
   180
sl@0
   181
/** Gets the details of the specified event. This is an asynchronous request.
sl@0
   182
sl@0
   183
There must be no asynchronous request outstanding when this function is called, 
sl@0
   184
otherwise the function raises a LogCli 0 panic.
sl@0
   185
sl@0
   186
@param aEvent A reference to a log event detail object. Before calling the 
sl@0
   187
function, this object must contain the appropriate unique event ID; if no 
sl@0
   188
unique event ID is set, the function raises a LogServ 50 panic. The caller 
sl@0
   189
must ensure that this object remains in existence and valid until the request 
sl@0
   190
is complete. On successful completion of the request, it contains the appropriate 
sl@0
   191
log event detail.
sl@0
   192
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   193
if successful; otherwise, one of the other system wide error codes.
sl@0
   194
@capability Note For built-in event types, the required capability level is defined in
sl@0
   195
the event type's read access policy.
sl@0
   196
@see TLogId */
sl@0
   197
EXPORT_C void CLogClient::GetEvent(CLogEvent& aEvent, TRequestStatus& aStatus)
sl@0
   198
	{
sl@0
   199
	Queue(aStatus);
sl@0
   200
	iGetEvent->Start(aEvent, iStatus);
sl@0
   201
	SetActive();
sl@0
   202
	}
sl@0
   203
sl@0
   204
/** Deletes the event with the specified unique event ID, from the main event log.
sl@0
   205
sl@0
   206
@param aId The unique event ID of the event to be deleted. This must not be 
sl@0
   207
the null unique event ID, KLogNullId, otherwise the function raises a LogCli 
sl@0
   208
13 panic.
sl@0
   209
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   210
if successful; otherwise, one of the other system wide error codes. 
sl@0
   211
@capability Note For built-in event types, the required capability level is defined in
sl@0
   212
the event type's write access policy.
sl@0
   213
*/
sl@0
   214
EXPORT_C void CLogClient::DeleteEvent(TLogId aId, TRequestStatus& aStatus)
sl@0
   215
	{
sl@0
   216
	Queue(aStatus);
sl@0
   217
	iDeleteEvent->Start(aId, iStatus);
sl@0
   218
	SetActive();
sl@0
   219
	}
sl@0
   220
sl@0
   221
/** Registers a new event type. This is an asynchronous request.
sl@0
   222
sl@0
   223
There must be no asynchronous request outstanding when this function is called, 
sl@0
   224
otherwise the function raises a LogCli 0 panic.
sl@0
   225
sl@0
   226
@param aType The event type detail object containing the attributes of the 
sl@0
   227
event type to be registered. The caller must ensure that this object remains 
sl@0
   228
in existence and valid until the request is complete.
sl@0
   229
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   230
if successful; otherwise, one of the other system wide error codes.
sl@0
   231
@capability WriteDeviceData
sl@0
   232
@see TUid */
sl@0
   233
EXPORT_C void CLogClient::AddEventType(const CLogEventType& aType, TRequestStatus& aStatus)
sl@0
   234
	{
sl@0
   235
	Queue(aStatus);
sl@0
   236
	iAddType->Start(aType, iStatus);
sl@0
   237
	SetActive();
sl@0
   238
	}
sl@0
   239
sl@0
   240
/** Gets the details of an event type. This is an asynchronous request.
sl@0
   241
sl@0
   242
There must be no asynchronous request outstanding when this function is called, 
sl@0
   243
otherwise the function raises a LogCli 0 panic.
sl@0
   244
sl@0
   245
@param aType A reference to an event type detail object. Before calling the 
sl@0
   246
function, this object must contain the UID identifying the event type; if 
sl@0
   247
no UID is set, the function raises a LogCli 13 panic. The caller must ensure 
sl@0
   248
that this object remains in existence and valid until the request is complete. 
sl@0
   249
On successful completion of the request, it contains the appropriate event 
sl@0
   250
type detail.
sl@0
   251
@param aStatus The request status. On request completion, contains: KErrNone, 
sl@0
   252
if successful; otherwise one of the other system wide error codes.
sl@0
   253
@capability Note None required.
sl@0
   254
@see TUid */
sl@0
   255
EXPORT_C void CLogClient::GetEventType(CLogEventType& aType, TRequestStatus& aStatus)
sl@0
   256
	{
sl@0
   257
	Queue(aStatus);
sl@0
   258
	iGetType->Start(aType, iStatus);
sl@0
   259
	SetActive();
sl@0
   260
	}
sl@0
   261
sl@0
   262
/** Changes the details of an existing event type. This is an asynchronous request.
sl@0
   263
sl@0
   264
There must be no asynchronous request outstanding when this function is called, 
sl@0
   265
otherwise the function raises a LogCli 0 panic.
sl@0
   266
sl@0
   267
@param aType The event type detail object containing the attributes of the 
sl@0
   268
event type to be changed. Before calling the function, this object must contain 
sl@0
   269
the UID identifying the event type; if no UID is set, the function raises 
sl@0
   270
a LogCli 13 panic. The caller must ensure that this object remains in existence 
sl@0
   271
and valid until the request is complete.
sl@0
   272
@param aStatus The request status. On request completion, contains: KErrNone, 
sl@0
   273
if successful; otherwise, one of the other system wide error codes.
sl@0
   274
@capability WriteDeviceData
sl@0
   275
@see TUid */
sl@0
   276
EXPORT_C void CLogClient::ChangeEventType(const CLogEventType& aType, TRequestStatus& aStatus)
sl@0
   277
	{
sl@0
   278
	Queue(aStatus);
sl@0
   279
	iChangeType->Start(aType, iStatus);
sl@0
   280
	SetActive();
sl@0
   281
	}
sl@0
   282
sl@0
   283
/** Removes an existing event type. This is an asynchronous request.
sl@0
   284
sl@0
   285
There must be no asynchronous request outstanding when this function is called, 
sl@0
   286
otherwise the function raises a LogCli 0 panic.
sl@0
   287
sl@0
   288
Note that this function does not remove events from the event log, so it is 
sl@0
   289
possible to have events in the log that are of an unknown type. This function 
sl@0
   290
allows an event type associated with a component to be removed when that component 
sl@0
   291
is uninstalled.
sl@0
   292
sl@0
   293
@param aId The UID of the event type to be deleted.
sl@0
   294
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   295
if successful; otherwise, one of the other system wide error codes. 
sl@0
   296
@capability WriteDeviceData
sl@0
   297
*/
sl@0
   298
EXPORT_C void CLogClient::DeleteEventType(TUid aId, TRequestStatus& aStatus)
sl@0
   299
	{
sl@0
   300
	Queue(aStatus);
sl@0
   301
	iDeleteType->Start(aId, iStatus);
sl@0
   302
	SetActive();
sl@0
   303
	}
sl@0
   304
sl@0
   305
/** Gets the Log Engine configuration. This is an asynchronous request.
sl@0
   306
sl@0
   307
There must be no asynchronous request outstanding when this function is called, 
sl@0
   308
otherwise the function raises a LogCli 0 panic.
sl@0
   309
sl@0
   310
@param aConfig A reference to a Log Engine configuration object. The caller 
sl@0
   311
must ensure that this object remains in existence and valid until the request 
sl@0
   312
is complete. On successful completion of the request, it contains the Log 
sl@0
   313
Engine configuration data.
sl@0
   314
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   315
if successful; otherwise, one of the other system wide error codes. 
sl@0
   316
@capability Note None required.
sl@0
   317
*/
sl@0
   318
EXPORT_C void CLogClient::GetConfig(TLogConfig& aConfig, TRequestStatus& aStatus)
sl@0
   319
	{
sl@0
   320
	Queue(aStatus);
sl@0
   321
	iGetConfig->Start(aConfig, iStatus);
sl@0
   322
	SetActive();
sl@0
   323
	}
sl@0
   324
sl@0
   325
/** Changes the Log Engine configuration. This is an asynchronous request.
sl@0
   326
sl@0
   327
There must be no asynchronous request outstanding when this function is called, 
sl@0
   328
otherwise the function raises a LogCli 0 panic.
sl@0
   329
sl@0
   330
@param aConfig The new configuration values for the Log Engine.
sl@0
   331
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   332
if successful; otherwise, one of the other system wide error codes. 
sl@0
   333
@capability WriteDeviceData */
sl@0
   334
EXPORT_C void CLogClient::ChangeConfig(const TLogConfig& aConfig, TRequestStatus& aStatus)
sl@0
   335
	{
sl@0
   336
	Queue(aStatus);
sl@0
   337
	iChangeConfig->Start(aConfig, iStatus);
sl@0
   338
	SetActive();
sl@0
   339
	}
sl@0
   340
sl@0
   341
/** Clears all events from the main event log that occurred before the specified 
sl@0
   342
date and time. This is an asynchronous request.
sl@0
   343
sl@0
   344
There must be no asynchronous request outstanding when this function is called, 
sl@0
   345
otherwise the function raises a LogCli 0 panic.
sl@0
   346
sl@0
   347
@param aDate The UTC date and time.
sl@0
   348
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   349
if successful; otherwise, one of the other system wide error codes. 
sl@0
   350
@capability WriteDeviceData  */
sl@0
   351
EXPORT_C void CLogClient::ClearLog(const TTime& aDate, TRequestStatus& aStatus)
sl@0
   352
	{
sl@0
   353
	Queue(aStatus);
sl@0
   354
	iClearLog->Start(aDate, iStatus);
sl@0
   355
	SetActive();
sl@0
   356
	}
sl@0
   357
sl@0
   358
/** Clears the specified recent event list. This is an asynchronous request.
sl@0
   359
sl@0
   360
There must be no asynchronous request outstanding when this function is called, 
sl@0
   361
otherwise the function raises a LogCli 0 panic.
sl@0
   362
sl@0
   363
@param aRecentList Identifies the recent event list to be cleared. The value 
sl@0
   364
KlogNullRecentList indicates that all recent event lists are to be cleared.
sl@0
   365
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   366
if successful; otherwise, one of the other system wide error codes. 
sl@0
   367
@capability WriteDeviceData  */
sl@0
   368
EXPORT_C void CLogClient::ClearLog(TInt aRecentList, TRequestStatus& aStatus)
sl@0
   369
	{
sl@0
   370
	Queue(aStatus);
sl@0
   371
	iClearRecent->Start((TLogRecentList)aRecentList, iStatus);
sl@0
   372
	SetActive();
sl@0
   373
	}
sl@0
   374
sl@0
   375
#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
sl@0
   376
sl@0
   377
/** 
sl@0
   378
Clears all events from the main event log that occurred before the specified 
sl@0
   379
date and time and logged with the supplied SIM short Id. This is an asynchronous request.
sl@0
   380
sl@0
   381
There must be no asynchronous request outstanding when this function is called, 
sl@0
   382
otherwise the function raises a LogCli 0 panic.
sl@0
   383
sl@0
   384
Note: If KLogNullSimId is passed as value of aSimId parameter, then the method will produce the same result as the
sl@0
   385
           ClearLog() method without SimId parameter - all events occured before  the specified data will be deleted,
sl@0
   386
	disregarding the SimId event property.
sl@0
   387
sl@0
   388
@param aDate   The UTC date and time.
sl@0
   389
@param aSimId  SIM card short Id.
sl@0
   390
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   391
               if successful; otherwise, one of the other system wide error codes. 
sl@0
   392
@capability WriteDeviceData  
sl@0
   393
*/
sl@0
   394
EXPORT_C void CLogClient::ClearLog(const TTime& aDate, TSimId aSimId, TRequestStatus& aStatus)
sl@0
   395
	{//Compiled when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM is defined
sl@0
   396
	Queue(aStatus);
sl@0
   397
	iClearLog->Start(aDate, iStatus, aSimId);
sl@0
   398
	SetActive();
sl@0
   399
	}
sl@0
   400
sl@0
   401
/** 
sl@0
   402
Clears the specified recent event list from events with the specified SIM short Id. 
sl@0
   403
This is an asynchronous request.
sl@0
   404
sl@0
   405
There must be no asynchronous request outstanding when this function is called, 
sl@0
   406
otherwise the function raises a LogCli 0 panic.
sl@0
   407
sl@0
   408
Note: If KLogNullSimId is passed as value of aSimId parameter, then the method will produce the same result as the
sl@0
   409
           ClearLog() method without SimId parameter - all events from the specified event list will be cleared,
sl@0
   410
	disregarding the SimId event property.
sl@0
   411
sl@0
   412
@param aRecentList Identifies the recent event list to be cleared. The value 
sl@0
   413
                   KlogNullRecentList indicates that all recent event lists are to be cleared.
sl@0
   414
@param aSimId      SIM card short Id.
sl@0
   415
@param aStatus     The request status. On request completion, contains:KErrNone, 
sl@0
   416
                   if successful; otherwise, one of the other system wide error codes. 
sl@0
   417
@capability WriteDeviceData  
sl@0
   418
*/
sl@0
   419
EXPORT_C void CLogClient::ClearLog(TInt aRecentList, TSimId aSimId, TRequestStatus& aStatus)
sl@0
   420
	{//Compiled when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM is defined
sl@0
   421
	Queue(aStatus);
sl@0
   422
	iClearRecent->Start((TLogRecentList)aRecentList, iStatus, aSimId);
sl@0
   423
	SetActive();
sl@0
   424
	}
sl@0
   425
sl@0
   426
#else //SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
sl@0
   427
sl@0
   428
#pragma BullseyeCoverage off
sl@0
   429
sl@0
   430
/**
sl@0
   431
Not supported. 
sl@0
   432
*/
sl@0
   433
EXPORT_C void CLogClient::ClearLog(const TTime&, TSimId, TRequestStatus&)
sl@0
   434
	{//Compiled when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM is not defined
sl@0
   435
	__ASSERT_ALWAYS(0, ::Panic(ELogDualSimNotSupported));
sl@0
   436
	}
sl@0
   437
sl@0
   438
/**
sl@0
   439
Not supported. 
sl@0
   440
*/
sl@0
   441
EXPORT_C void CLogClient::ClearLog(TInt, TSimId, TRequestStatus&)
sl@0
   442
	{//Compiled when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM is not defined
sl@0
   443
	__ASSERT_ALWAYS(0, ::Panic(ELogDualSimNotSupported));
sl@0
   444
	}
sl@0
   445
sl@0
   446
#pragma BullseyeCoverage on
sl@0
   447
sl@0
   448
#endif//SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
sl@0
   449
sl@0
   450
/** Requests notification of changes to the Log Engine database. This is an asynchronous 
sl@0
   451
request.
sl@0
   452
sl@0
   453
The function requires the caller to specify a minimum time that must elapse 
sl@0
   454
before this notification request can complete. The Log Engine buffers all 
sl@0
   455
changes that occur during this time; the request, then completes after this 
sl@0
   456
minimum time period has elapsed. If no changes occur within this time period, 
sl@0
   457
then the request completes when the next change to the database occurs.
sl@0
   458
sl@0
   459
There must be no asynchronous request outstanding when this function is called, 
sl@0
   460
otherwise the function raises a LogCli 0 panic.
sl@0
   461
sl@0
   462
Note that once a notification request has completed, this function must be 
sl@0
   463
called again to get further change notifications.
sl@0
   464
sl@0
   465
@param aDelay The minimum time, in microseconds, that elapses before the notification 
sl@0
   466
request can complete.
sl@0
   467
@param aStatus The request status. On request completion, contains:KErrNone, 
sl@0
   468
if successful;KErrCancel, if an outstanding notification request is cancelled; 
sl@0
   469
otherwise, one of the other system wide error codes. 
sl@0
   470
@capability Note None required.
sl@0
   471
*/
sl@0
   472
EXPORT_C void CLogClient::NotifyChange(TTimeIntervalMicroSeconds32 aDelay, TRequestStatus& aStatus)
sl@0
   473
	{
sl@0
   474
	aStatus = KRequestPending;
sl@0
   475
sl@0
   476
	iSession->Send(ELogNotify, TIpcArgs(aDelay.Int()), aStatus);
sl@0
   477
}
sl@0
   478
sl@0
   479
/** Cancels any outstanding notification request for changes to Log Engine database.
sl@0
   480
sl@0
   481
This function can be called even if there is no outstanding notification request. 
sl@0
   482
@capability Note None required  */
sl@0
   483
EXPORT_C void CLogClient::NotifyChangeCancel()
sl@0
   484
	{
sl@0
   485
	iSession->Send(ELogNotifyCancel, TIpcArgs());
sl@0
   486
	}
sl@0
   487
sl@0
   488
/**
sl@0
   489
@capability Note None required
sl@0
   490
*/
sl@0
   491
EXPORT_C void CLogClient::SetGlobalChangeObserverL(MLogClientChangeObserver* aObserver)
sl@0
   492
	{
sl@0
   493
	delete iChangeObserver;
sl@0
   494
	iChangeObserver = NULL;
sl@0
   495
	//
sl@0
   496
	if	(aObserver)
sl@0
   497
		{
sl@0
   498
		iChangeObserver = CLogClientObserver::NewL(*this, *aObserver, Priority());
sl@0
   499
		}
sl@0
   500
	}
sl@0
   501
sl@0
   502
/** Gets a standard string from the specified resource in logwrap.dll resource 
sl@0
   503
file.
sl@0
   504
sl@0
   505
The function can be used to populate some of the event fields in a CLogEvent 
sl@0
   506
object before creating or changing an event.
sl@0
   507
sl@0
   508
Note that TLogString is a modifiable buffer descriptor that is guaranteed 
sl@0
   509
to be large enough to contain all standard strings used in the Log Engine; 
sl@0
   510
pass an instance of this type to this function.
sl@0
   511
sl@0
   512
@param aString A modifiable descriptor into which the string is copied.
sl@0
   513
@param aId The resource id.
sl@0
   514
@return KErrNone, if successful; otherwise, one of the other system wide error 
sl@0
   515
codes.
sl@0
   516
@capability Note None required.
sl@0
   517
@see TLogString */
sl@0
   518
EXPORT_C TInt CLogClient::GetString(TDes& aString, TInt aId) const
sl@0
   519
	{
sl@0
   520
	aString.Zero();
sl@0
   521
	TRAPD(err, DoGetStringL(aString, aId));
sl@0
   522
	return err;
sl@0
   523
	}
sl@0
   524
sl@0
   525
void CLogClient::DoGetStringL(TDes& aString, TInt aId) const
sl@0
   526
	{
sl@0
   527
	RResourceReader reader;
sl@0
   528
#ifdef _DEBUG
sl@0
   529
	const CResourceFile* rcFile = ResourceFile();
sl@0
   530
	__ASSERT_DEBUG(rcFile != NULL, Panic(ELogNullRcFile));
sl@0
   531
#endif
sl@0
   532
	reader.OpenLC(ResourceFile(), aId);
sl@0
   533
	aString.Copy(reader.ReadTPtrCL());
sl@0
   534
	CleanupStack::PopAndDestroy();			// reader
sl@0
   535
	}
sl@0
   536
sl@0
   537
void CLogClient::DoCancel()
sl@0
   538
	{
sl@0
   539
	LOGTEXT("CLogClient::DoCancel()");
sl@0
   540
sl@0
   541
	iAddEvent->Cancel();
sl@0
   542
	iChangeEvent->Cancel();
sl@0
   543
	iGetEvent->Cancel();
sl@0
   544
	iDeleteEvent->Cancel();
sl@0
   545
	iAddType->Cancel();
sl@0
   546
	iChangeType->Cancel();
sl@0
   547
	iGetType->Cancel();
sl@0
   548
	iDeleteType->Cancel();
sl@0
   549
	iGetConfig->Cancel(); 
sl@0
   550
	iChangeConfig->Cancel();
sl@0
   551
	iClearLog->Cancel();
sl@0
   552
	iClearRecent->Cancel();
sl@0
   553
sl@0
   554
	CLogBase::DoCancel();
sl@0
   555
	LOGTEXT("CLogClient::DoCancel() - end");
sl@0
   556
	}
sl@0
   557
sl@0
   558
void CLogClient::DoRunL()
sl@0
   559
	{
sl@0
   560
	LOGTEXT2("CLogClient::DoRunL(%d)", iStatus.Int());
sl@0
   561
	User::LeaveIfError(iStatus.Int());
sl@0
   562
	LOGTEXT("CLogClient::DoRunL() - end");
sl@0
   563
	}
sl@0
   564
sl@0
   565
RLogSession& CLogClient::Session() const
sl@0
   566
	{
sl@0
   567
	return *iSession;
sl@0
   568
	}
sl@0
   569
sl@0
   570
#pragma BullseyeCoverage off
sl@0
   571
sl@0
   572
EXPORT_C void CLogClient::CLogBase_Reserved1()
sl@0
   573
	{
sl@0
   574
	}
sl@0
   575
sl@0
   576
#pragma BullseyeCoverage on