os/persistentdata/loggingservices/eventlogger/LogCli/inc/LOGCLI.H
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __LOGCLI_H__
    17 #define __LOGCLI_H__
    18 
    19 // System includes
    20 #include <f32file.h>
    21 #include <d32dbms.h>
    22 #include <logwrap.h>
    23 
    24 // Classes referenced
    25 class CLogClientObserver;
    26 class MLogClientChangeObserver;
    27 
    28 
    29 //**********************************
    30 // CLogEventType
    31 //**********************************
    32 
    33 /** Encapsulates the details of an event type.
    34 
    35 An event type is used to associate an event with a user-readable description 
    36 and other configuration information related to the event.
    37 
    38 Event types are identified by UID.
    39 
    40 @see CLogEvent::EventType()
    41 @see CLogEvent::SetEventType()
    42 @publishedAll 
    43 @released
    44 */
    45 class CLogEventType : public CBase
    46 	{
    47 public:
    48 	IMPORT_C static CLogEventType* NewL();
    49 	IMPORT_C ~CLogEventType();
    50 	//
    51 public:
    52 	inline TUid Uid() const;
    53 	inline void SetUid(TUid aUid);
    54 	//
    55 	inline const TDesC& Description() const;
    56 	inline void SetDescription(const TDesC& aDescription);
    57 	//
    58 	inline TBool LoggingEnabled() const;
    59 	inline void SetLoggingEnabled(TBool aEnable);
    60 	//
    61 	IMPORT_C void Copy(const CLogEventType& aType);
    62 
    63 	void InternalizeL(RReadStream& aStream);
    64 	void ExternalizeL(RWriteStream& aStream) const;
    65 	//
    66 private:
    67 	CLogEventType();
    68 	void ConstructL();
    69 	void InternalizeBufL(RReadStream& aStream, HBufC*& aDes);
    70 	//
    71 private:
    72 	TUid iUid;
    73 	HBufC* iDescription;
    74 	TBool iLoggingEnabled;
    75 	};
    76 
    77 //**********************************
    78 // TLogConfig
    79 //**********************************
    80 
    81 /** Encapsulates Log Engine configuration data.
    82 
    83 @see CLogClient::GetConfig()
    84 @see CLogClient::ChangeConfig()
    85 @publishedAll
    86 @released
    87 */
    88 class TLogConfig
    89 	{
    90 public:
    91 	IMPORT_C TLogConfig();
    92 	//
    93 	void InternalizeL(RReadStream& aStream);
    94 	void ExternalizeL(RWriteStream& aStream) const;
    95 	//
    96 public:
    97 	/** The maximum number of events that the event log holds.
    98 	
    99 	If the number of event log entries exceeds this value, the oldest event is 
   100 	deleted from the log. */
   101 	TLogSize iMaxLogSize;
   102 	
   103 	/** The maximum number of events that a recent event list holds.
   104 	
   105 	If the number of recent event list entries exceeds this value, the oldest 
   106 	event is removed from the list. Note, however, that the event is not deleted 
   107 	from the event log. */
   108 	TLogRecentSize iMaxRecentLogSize;
   109 	
   110 	/** The maximum age, in seconds, for which events can be retained in the event log.
   111 	
   112 	Events older than this are automatically deleted from the event log. 
   113 	
   114 	Purging of events by age can be disabled by setting this value to 0. */
   115 	TLogAge iMaxEventAge;
   116 	};
   117 
   118 //**********************************
   119 // CLogFilter
   120 //**********************************
   121 
   122 /** Specifies the conditions that events must satisfy to appear in a view.
   123 
   124 In general, a filter is used to construct the WHERE clause of an SQL 
   125 statement based on the content of the filter's fields. The filter's fields 
   126 correspond to the event properties in a log event detail object, i.e. an instance 
   127 of the CLogEvent class.
   128 
   129 Where a filter uses time to extract one or more events from the log, this must be 
   130 specified as UTC rather than local time.
   131 
   132 @see CLogEvent
   133 @see CLogViewEvent
   134 @see CLogViewRecent
   135 @see CLogViewDuplicate
   136 @publishedAll
   137 @released
   138 */
   139 class CLogFilter : public CBase
   140 	{
   141 public:
   142 	IMPORT_C static CLogFilter* NewL();
   143 	IMPORT_C ~CLogFilter();
   144 	//
   145 public:
   146 	inline TUid EventType() const;
   147 	inline void SetEventType(TUid aType);
   148 	//
   149 	inline const TDesC& RemoteParty() const;
   150 	inline void SetRemoteParty(const TDesC& aRemote);
   151 	//
   152 	inline const TDesC& Direction() const;
   153 	inline void SetDirection(const TDesC& aDirection);
   154 	//
   155 	inline TLogDurationType DurationType() const;
   156 	inline void SetDurationType(TLogDurationType aType);
   157 	//
   158 	inline const TDesC& Status() const;
   159 	inline void SetStatus(const TDesC& aStatus);
   160 	//
   161 	inline TLogContactItemId  Contact() const;
   162 	inline void SetContact(TLogContactItemId  aContact);
   163 	//
   164 	inline const TDesC& Number() const;
   165 	inline void SetNumber(const TDesC& aNumber);
   166 	//
   167 	inline TLogFlags Flags() const;
   168 	inline void SetFlags(TLogFlags aFlags);
   169 	inline void ClearFlags(TLogFlags aFlags);
   170 	//
   171 	inline TUint32 NullFields() const;
   172 	inline void SetNullFields(TUint32 aFields);
   173 	//
   174 	inline const TTime& StartTime() const;
   175 	inline void SetStartTime(const TTime& aStartTime);	
   176 	//
   177 	inline const TTime& EndTime() const;
   178 	inline void SetEndTime(const TTime& aEndTime);
   179 	//
   180 	IMPORT_C void Copy(const CLogFilter& aFilter);
   181 	void InternalizeL(RReadStream& aStream);
   182 	void ExternalizeL(RWriteStream& aStream) const;
   183 	//
   184 	IMPORT_C void SetSimId(TSimId aSimId);
   185 	IMPORT_C TSimId SimId() const;
   186 	//
   187 private:
   188 	CLogFilter();
   189 	void ConstructL();
   190 	void InternalizeBufL(RReadStream& aStream, HBufC*& aDes);
   191 	//
   192 private:
   193 	TUid iEventType;
   194 	HBufC* iRemoteParty;
   195 	HBufC* iDirection;
   196 	TLogDurationType iDurationType;
   197 	HBufC* iStatus;
   198 	TLogContactItemId  iContact;
   199 	HBufC* iNumber;
   200 	TLogFlags iFlags;
   201 	TUint32 iNullFields;
   202 	TTime iStartTime;
   203 	TTime iEndTime;
   204 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
   205 	TSimId iSimId;
   206 #endif
   207 	};
   208 
   209 /** A set of event view filters.
   210 
   211 Specifically, this is an array of pointers to const CLogFilter objects and 
   212 is derived from CArrayPtrFlat<const CLogFilter>.
   213 
   214 @see CLogFilter
   215 @see CLogViewEvent
   216 @see CLogViewRecent
   217 @publishedAll
   218 @released
   219 */
   220 class CLogFilterList : public CArrayPtrFlat<const CLogFilter>
   221 	{
   222 public:
   223 	IMPORT_C CLogFilterList();
   224 	IMPORT_C CLogFilterList* CopyL() const;
   225 	IMPORT_C CLogFilterList* CopyLC() const;
   226 	void InternalizeL(RReadStream& aStream);
   227 	void ExternalizeL(RWriteStream& aStream) const;
   228 	};
   229 
   230 //**********************************
   231 // CLogClient
   232 //**********************************
   233 
   234 class CLogView;
   235 class RLogSession;
   236 class CLogPackage;
   237 class CLogAddEventClientOp;
   238 class CLogChangeEventClientOp;
   239 class CLogGetEventClientOp;
   240 class CLogDeleteEventClientOp;
   241 class CLogAddTypeClientOp;
   242 class CLogChangeTypeClientOp;
   243 class CLogGetTypeClientOp;
   244 class CLogDeleteTypeClientOp;
   245 class CLogGetConfigClientOp;
   246 class CLogChangeConfigClientOp;
   247 class CLogClearLogClientOp;
   248 class CLogClearRecentClientOp;
   249 
   250 /** Log Engine implementation.
   251 
   252 It creates a shared session on the log database and allows log viewers to 
   253 retrieve events from the log.
   254 
   255 The class also provides log administration functions.
   256 
   257 Wherever time values are used by this class, they must be specified as UTC rather
   258 than local time. 
   259 
   260 @see CLogWrapper
   261 @publishedAll
   262 @released
   263 */
   264 class CLogClient : public CLogBase
   265 	{
   266 public:
   267 	IMPORT_C static CLogClient* NewL(RFs& aFs, TInt aPriority = CActive::EPriorityStandard);
   268 	IMPORT_C ~CLogClient();
   269 	//
   270 public:
   271 	IMPORT_C void AddEvent(CLogEvent& aEvent, TRequestStatus& aStatus);
   272 	IMPORT_C void GetEvent(CLogEvent& aEvent, TRequestStatus& aStatus);
   273 	IMPORT_C void ChangeEvent(const CLogEvent& aEvent, TRequestStatus& aStatus);
   274 	IMPORT_C void DeleteEvent(TLogId aId, TRequestStatus& aStatus);
   275 
   276 	IMPORT_C void AddEventType(const CLogEventType& aType, TRequestStatus& aStatus);
   277 	IMPORT_C void GetEventType(CLogEventType& aType, TRequestStatus& aStatus);
   278 	IMPORT_C void ChangeEventType(const CLogEventType& aType, TRequestStatus& aStatus);
   279 	IMPORT_C void DeleteEventType(TUid aId, TRequestStatus& aStatus);
   280 	IMPORT_C void GetConfig(TLogConfig& aConfig, TRequestStatus& aStatus);
   281 	IMPORT_C void ChangeConfig(const TLogConfig& aConfig, TRequestStatus& aStatus);
   282 	IMPORT_C void ClearLog(const TTime& aDate, TRequestStatus& aStatus);
   283 	IMPORT_C void ClearLog(TInt aRecentList, TRequestStatus& aStatus);
   284 	IMPORT_C void ClearLog(const TTime& aDate, TSimId aSimid, TRequestStatus& aStatus);
   285 	IMPORT_C void ClearLog(TInt aRecentList, TSimId aSimid, TRequestStatus& aStatus);
   286 	//
   287 	IMPORT_C void NotifyChange(TTimeIntervalMicroSeconds32 aDelay, TRequestStatus& aStatus);
   288 	IMPORT_C void NotifyChangeCancel();
   289 	//
   290 	IMPORT_C void SetGlobalChangeObserverL(MLogClientChangeObserver* aObserver);
   291 	//
   292 	IMPORT_C TInt GetString(TDes& aString, TInt aId) const;
   293 	RLogSession& Session() const;
   294 	//
   295 private:
   296 	CLogClient(RFs& aFs, TInt aPriority);
   297 	void ConstructL();
   298 	void DoGetStringL(TDes& aString, TInt aId) const;
   299 	//
   300 	void DoRunL();
   301 	void DoCancel();
   302 	//
   303 private:
   304 	RLogSession* iSession;
   305 	CLogPackage* iPackage;
   306 	CLogAddEventClientOp* iAddEvent;
   307 	CLogChangeEventClientOp* iChangeEvent;
   308 	CLogGetEventClientOp* iGetEvent;
   309 	CLogDeleteEventClientOp* iDeleteEvent;
   310 	CLogAddTypeClientOp* iAddType;
   311 	CLogChangeTypeClientOp* iChangeType;
   312 	CLogGetTypeClientOp* iGetType;
   313 	CLogDeleteTypeClientOp* iDeleteType;
   314 	CLogGetConfigClientOp* iGetConfig;
   315 	CLogChangeConfigClientOp* iChangeConfig;
   316 	CLogClearLogClientOp* iClearLog;
   317 	CLogClearRecentClientOp* iClearRecent;
   318 	RFs& iFs;
   319 	CLogClientObserver* iChangeObserver;
   320 	//
   321 private:
   322 	IMPORT_C void CLogBase_Reserved1();
   323 	};
   324 
   325 #include <logcli.inl>
   326 
   327 #endif