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