epoc32/include/logcli.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 logcli.h
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 class CLogEventType : public CBase
       
    36 /** Encapsulates the details of an event type.
       
    37 
       
    38 An event type is used to associate an event with a user-readable description 
       
    39 and other configuration information related to the event.
       
    40 
       
    41 Event types are identified by UID.
       
    42 
       
    43 @see CLogEvent::EventType()
       
    44 @see CLogEvent::SetEventType()
       
    45 @publishedAll 
       
    46 @released
       
    47 */
       
    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 class TLogConfig
       
    84 /** Encapsulates Log Engine configuration data.
       
    85 
       
    86 @see CLogClient::GetConfig()
       
    87 @see CLogClient::ChangeConfig()
       
    88 @publishedAll
       
    89 @released
       
    90 */
       
    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 class CLogFilter : public CBase
       
   125 /** Specifies the conditions that events must satisfy to appear in a view.
       
   126 
       
   127 In general, a filter is used to construct the WHERE clause of an SQL 
       
   128 statement based on the content of the filter's fields. The filter's fields 
       
   129 correspond to the event properties in a log event detail object, i.e. an instance 
       
   130 of the CLogEvent class.
       
   131 
       
   132 Where a filter uses time to extract one or more events from the log, this must be 
       
   133 specified as UTC rather than local time.
       
   134 
       
   135 @see CLogEvent
       
   136 @see CLogViewEvent
       
   137 @see CLogViewRecent
       
   138 @see CLogViewDuplicate
       
   139 @publishedAll
       
   140 @released
       
   141 */
       
   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 private:
       
   187 	CLogFilter();
       
   188 	void ConstructL();
       
   189 	void InternalizeBufL(RReadStream& aStream, HBufC*& aDes);
       
   190 	//
       
   191 private:
       
   192 	TUid iEventType;
       
   193 	HBufC* iRemoteParty;
       
   194 	HBufC* iDirection;
       
   195 	TLogDurationType iDurationType;
       
   196 	HBufC* iStatus;
       
   197 	TLogContactItemId  iContact;
       
   198 	HBufC* iNumber;
       
   199 	TLogFlags iFlags;
       
   200 	TUint32 iNullFields;
       
   201 	TTime iStartTime;
       
   202 	TTime iEndTime;
       
   203 	};
       
   204 
       
   205 class CLogFilterList : public CArrayPtrFlat<const CLogFilter>
       
   206 /** A set of event view filters.
       
   207 
       
   208 Specifically, this is an array of pointers to const CLogFilter objects and 
       
   209 is derived from CArrayPtrFlat<const CLogFilter>.
       
   210 
       
   211 @see CLogFilter
       
   212 @see CLogViewEvent
       
   213 @see CLogViewRecent
       
   214 @publishedAll
       
   215 @released
       
   216 */
       
   217 	{
       
   218 public:
       
   219 	IMPORT_C CLogFilterList();
       
   220 	IMPORT_C CLogFilterList* CopyL() const;
       
   221 	IMPORT_C CLogFilterList* CopyLC() const;
       
   222 	void InternalizeL(RReadStream& aStream);
       
   223 	void ExternalizeL(RWriteStream& aStream) const;
       
   224 	};
       
   225 
       
   226 //**********************************
       
   227 // CLogClient
       
   228 //**********************************
       
   229 
       
   230 class CLogView;
       
   231 class RLogSession;
       
   232 class CLogPackage;
       
   233 class CLogAddEventClientOp;
       
   234 class CLogChangeEventClientOp;
       
   235 class CLogGetEventClientOp;
       
   236 class CLogDeleteEventClientOp;
       
   237 class CLogAddTypeClientOp;
       
   238 class CLogChangeTypeClientOp;
       
   239 class CLogGetTypeClientOp;
       
   240 class CLogDeleteTypeClientOp;
       
   241 class CLogGetConfigClientOp;
       
   242 class CLogChangeConfigClientOp;
       
   243 class CLogClearLogClientOp;
       
   244 class CLogClearRecentClientOp;
       
   245 
       
   246 class CLogClient : public CLogBase
       
   247 /** Log Engine implementation.
       
   248 
       
   249 It creates a shared session on the log database and allows log viewers to 
       
   250 retrieve events from the log.
       
   251 
       
   252 The class also provides log administration functions.
       
   253 
       
   254 Wherever time values are used by this class, they must be specified as UTC rather
       
   255 than local time. 
       
   256 
       
   257 @see CLogWrapper
       
   258 @publishedAll
       
   259 @released
       
   260 */
       
   261 	{
       
   262 public:
       
   263 	IMPORT_C static CLogClient* NewL(RFs& aFs, TInt aPriority = CActive::EPriorityStandard);
       
   264 	IMPORT_C ~CLogClient();
       
   265 	//
       
   266 public:
       
   267 	IMPORT_C void AddEvent(CLogEvent& aEvent, TRequestStatus& aStatus);
       
   268 	IMPORT_C void GetEvent(CLogEvent& aEvent, TRequestStatus& aStatus);
       
   269 	IMPORT_C void ChangeEvent(const CLogEvent& aEvent, TRequestStatus& aStatus);
       
   270 	IMPORT_C void DeleteEvent(TLogId aId, TRequestStatus& aStatus);
       
   271 
       
   272 	IMPORT_C void AddEventType(const CLogEventType& aType, TRequestStatus& aStatus);
       
   273 	IMPORT_C void GetEventType(CLogEventType& aType, TRequestStatus& aStatus);
       
   274 	IMPORT_C void ChangeEventType(const CLogEventType& aType, TRequestStatus& aStatus);
       
   275 	IMPORT_C void DeleteEventType(TUid aId, TRequestStatus& aStatus);
       
   276 	IMPORT_C void GetConfig(TLogConfig& aConfig, TRequestStatus& aStatus);
       
   277 	IMPORT_C void ChangeConfig(const TLogConfig& aConfig, TRequestStatus& aStatus);
       
   278 	IMPORT_C void ClearLog(const TTime& aDate, TRequestStatus& aStatus);
       
   279 	IMPORT_C void ClearLog(TInt aRecentList, TRequestStatus& aStatus);
       
   280 	//
       
   281 	IMPORT_C void NotifyChange(TTimeIntervalMicroSeconds32 aDelay, TRequestStatus& aStatus);
       
   282 	IMPORT_C void NotifyChangeCancel();
       
   283 	//
       
   284 	IMPORT_C void SetGlobalChangeObserverL(MLogClientChangeObserver* aObserver);
       
   285 	//
       
   286 	IMPORT_C TInt GetString(TDes& aString, TInt aId) const;
       
   287 	RLogSession& Session() const;
       
   288 	//
       
   289 private:
       
   290 	CLogClient(RFs& aFs, TInt aPriority);
       
   291 	void ConstructL();
       
   292 	void DoGetStringL(TDes& aString, TInt aId) const;
       
   293 	//
       
   294 	void DoRunL();
       
   295 	void DoCancel();
       
   296 	//
       
   297 private:
       
   298 	RLogSession* iSession;
       
   299 	CLogPackage* iPackage;
       
   300 	CLogAddEventClientOp* iAddEvent;
       
   301 	CLogChangeEventClientOp* iChangeEvent;
       
   302 	CLogGetEventClientOp* iGetEvent;
       
   303 	CLogDeleteEventClientOp* iDeleteEvent;
       
   304 	CLogAddTypeClientOp* iAddType;
       
   305 	CLogChangeTypeClientOp* iChangeType;
       
   306 	CLogGetTypeClientOp* iGetType;
       
   307 	CLogDeleteTypeClientOp* iDeleteType;
       
   308 	CLogGetConfigClientOp* iGetConfig;
       
   309 	CLogChangeConfigClientOp* iChangeConfig;
       
   310 	CLogClearLogClientOp* iClearLog;
       
   311 	CLogClearRecentClientOp* iClearRecent;
       
   312 	RFs& iFs;
       
   313 	CLogClientObserver* iChangeObserver;
       
   314 	//
       
   315 private:
       
   316 	IMPORT_C void CLogBase_Reserved1();
       
   317 	};
       
   318 
       
   319 #include <logcli.inl>
       
   320 
       
   321 #endif