os/persistentdata/loggingservices/eventlogger/LogWrap/inc/LOGWRAP.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/loggingservices/eventlogger/LogWrap/inc/LOGWRAP.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,302 @@
     1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __LOGWRAP_H__
    1.20 +#define __LOGWRAP_H__
    1.21 +
    1.22 +#include <e32base.h>
    1.23 +#include <f32file.h>
    1.24 +#include <barsc2.h> // For CResourceFile
    1.25 +#include <d32dbms.h>
    1.26 +#include <logwrapconst.h>
    1.27 +
    1.28 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS 
    1.29 +	#include <logwraplimits.h>
    1.30 +	#include "logcntdef.h"
    1.31 +#endif
    1.32 +
    1.33 +#ifndef __WINC__
    1.34 +#include <logwrap.rsg>
    1.35 +#endif
    1.36 +
    1.37 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS 
    1.38 +/** 
    1.39 +Contact item ID. These are used to uniquely identify contact items within a contacts database.
    1.40 +@publishedAll
    1.41 +@released 
    1.42 +*/
    1.43 +typedef TInt32 TLogContactItemId;
    1.44 +
    1.45 +#endif
    1.46 +
    1.47 +/**
    1.48 +@publishedAll
    1.49 +@released
    1.50 +*/
    1.51 +typedef TUint32	TLogViewId;
    1.52 +
    1.53 +
    1.54 +const TLogFlags KLogNullFlags = 0;
    1.55 +const TLogFlags KLogFlagsMask = 0xF;
    1.56 +
    1.57 +
    1.58 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS 
    1.59 +/**
    1.60 +@internalAll
    1.61 +*/
    1.62 +const TInt KLogActiveDoNotCompleteIfActive = KMaxTInt-1;
    1.63 +#endif
    1.64 +
    1.65 +//SimId typedef. Probably the final version will import it from different header. 
    1.66 +typedef TUint32 TSimId;
    1.67 +//"Null" SimId value.
    1.68 +const TSimId KLogNullSimId = 0;
    1.69 +
    1.70 +//**********************************
    1.71 +// CLogActive
    1.72 +//**********************************
    1.73 +
    1.74 +/** 
    1.75 +Common active object behaviour.
    1.76 +
    1.77 +This is an abstract class that defines common active object behaviour for 
    1.78 +the log engine classes.
    1.79 +@publishedAll
    1.80 +@released
    1.81 +*/
    1.82 +class CLogActive : public CActive
    1.83 +	{
    1.84 +public:
    1.85 +	IMPORT_C ~CLogActive();
    1.86 +	//
    1.87 +protected:
    1.88 +	IMPORT_C CLogActive(TInt aPriority);
    1.89 +	IMPORT_C void Queue(TRequestStatus& aStatus);
    1.90 +	IMPORT_C void Complete(TInt aStatus);
    1.91 +	IMPORT_C void DoCancel();
    1.92 +	//
    1.93 +private:
    1.94 +	//
    1.95 +	IMPORT_C void RunL();
    1.96 +	virtual void DoRunL()=0;
    1.97 +	IMPORT_C virtual void DoComplete(TInt&);
    1.98 +	//
    1.99 +private:
   1.100 +	TRequestStatus* iReport;
   1.101 +	};
   1.102 +
   1.103 +//**********************************
   1.104 +// CLogEvent
   1.105 +//**********************************
   1.106 +
   1.107 +/** 
   1.108 +Encapsulates the details of an event.
   1.109 +
   1.110 +Where time is used, it must be specified as UTC rather than local time.
   1.111 +
   1.112 +@publishedAll
   1.113 +@released
   1.114 +*/
   1.115 +class CLogEvent : public CBase
   1.116 +	{
   1.117 +public:
   1.118 +	IMPORT_C static CLogEvent* NewL();
   1.119 +	IMPORT_C ~CLogEvent();
   1.120 +	//
   1.121 +public:
   1.122 +	inline TLogId Id() const;
   1.123 +	inline void SetId(TLogId aId);
   1.124 +	//
   1.125 +	inline TUid EventType() const;
   1.126 +	inline void SetEventType(TUid aId);
   1.127 +	//
   1.128 +	inline const TDesC& RemoteParty() const;
   1.129 +	inline void SetRemoteParty(const TDesC& aRemote);
   1.130 +	//
   1.131 +	inline const TDesC& Direction() const;
   1.132 +	inline void SetDirection(const TDesC& aDirection);
   1.133 +	//
   1.134 +	inline const TTime& Time() const;
   1.135 +	inline void SetTime(const TTime& aTime);
   1.136 +	//
   1.137 +	inline TLogDurationType DurationType() const;
   1.138 +	inline void SetDurationType(TLogDurationType aDurationType);
   1.139 +	//
   1.140 +	inline TLogDuration Duration() const;
   1.141 +	inline void SetDuration(TLogDuration aDuration);
   1.142 +	//
   1.143 +	inline const TDesC& Status() const;
   1.144 +	inline void SetStatus(const TDesC& aStatus);
   1.145 +	//
   1.146 +	inline const TDesC& Subject() const;
   1.147 +	inline void SetSubject(const TDesC& aSubject);
   1.148 +	//
   1.149 +	inline const TDesC& Number() const;
   1.150 +	inline void SetNumber(const TDesC& aNumber);
   1.151 +	//
   1.152 +	inline TLogContactItemId Contact() const;
   1.153 +	inline void SetContact(TLogContactItemId  aContact);
   1.154 +	//
   1.155 +	inline TLogLink Link() const;
   1.156 +	inline void SetLink(TLogLink aLink);
   1.157 +	//
   1.158 +	inline const TDesC& Description() const;
   1.159 +	inline void SetDescription(const TDesC& aDescription);
   1.160 +	//
   1.161 +	inline TLogFlags Flags() const;
   1.162 +	inline void SetFlags(TLogFlags aFlags);
   1.163 +	inline void ClearFlags(TLogFlags aFlags);
   1.164 +	//
   1.165 +	inline const TDesC8& Data() const;
   1.166 +	IMPORT_C void SetDataL(RReadStream& aStream, TInt aLen);
   1.167 +	IMPORT_C void SetDataL(const TDesC8& aData);
   1.168 +	//
   1.169 +	IMPORT_C void CopyL(const CLogEvent& aEvent);
   1.170 +
   1.171 +	IMPORT_C void InternalizeL(RReadStream& aStream);
   1.172 +	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   1.173 +	//
   1.174 +	IMPORT_C void SetSimId(TSimId aSimId);
   1.175 +	IMPORT_C TSimId SimId() const;
   1.176 +	//
   1.177 +private:
   1.178 +	CLogEvent();
   1.179 +	void ConstructL();
   1.180 +	void InternalizeBufL(RReadStream& aStream, HBufC*& aDes);
   1.181 +	//
   1.182 +private:
   1.183 +	TLogId iId;
   1.184 +	TUid iEventType;
   1.185 +	TTime iTime;
   1.186 +	TLogDurationType iDurationType;
   1.187 +	TLogDuration iDuration;
   1.188 +	TLogContactItemId  iContact;
   1.189 +	TLogLink iLink;
   1.190 +	TLogFlags iFlags;
   1.191 +	HBufC* iDescription;
   1.192 +	HBufC* iRemoteParty;
   1.193 +	HBufC* iDirection;
   1.194 +	HBufC* iStatus;
   1.195 +	HBufC* iSubject;
   1.196 +	HBufC* iNumber;
   1.197 +	HBufC8* iData;
   1.198 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.199 +	TSimId	iSimId;
   1.200 +#endif	
   1.201 +	};
   1.202 +
   1.203 +//**********************************
   1.204 +// CLogBase
   1.205 +//**********************************
   1.206 +
   1.207 +/** 
   1.208 +Base class for the log engine implementation.
   1.209 +
   1.210 +This class defines the interface that client code uses to perform simple actions 
   1.211 +on the log database.
   1.212 +
   1.213 +The class provides default implementations for the event handling functions. 
   1.214 +The Log Engine, i.e. an instance of CLogClient, is derived from this class 
   1.215 +and provides implementations for the event handling functions.
   1.216 +
   1.217 +The class also deals with some aspects of resource file handling.
   1.218 +
   1.219 +An instance of this class is constructed by the log wrapper, CLogWrapper, 
   1.220 +if the phone does not implement logging.
   1.221 +
   1.222 +An instance of this class is never constructed by clients.
   1.223 +
   1.224 +@see CLogClient
   1.225 +@see CLogWrapper
   1.226 +@publishedAll
   1.227 +@released
   1.228 +*/
   1.229 +class CLogBase : public CLogActive
   1.230 +	{
   1.231 +public:
   1.232 +	IMPORT_C CLogBase(TInt aPriority);
   1.233 +	IMPORT_C ~CLogBase();
   1.234 +	//
   1.235 +	IMPORT_C virtual void GetEvent(CLogEvent& aEvent, TRequestStatus& aStatus);
   1.236 +	IMPORT_C virtual void AddEvent(CLogEvent& aEvent, TRequestStatus& aStatus);
   1.237 +	IMPORT_C virtual void ChangeEvent(const CLogEvent& aEvent, TRequestStatus& aStatus);
   1.238 +	IMPORT_C virtual void DeleteEvent(TLogId aId, TRequestStatus& aStatus);
   1.239 +	//
   1.240 +	IMPORT_C virtual TInt GetString(TDes& aString, TInt aId) const;
   1.241 +	//
   1.242 +protected:
   1.243 +	IMPORT_C void LoadResourcesL(RFs& aFs);
   1.244 +	inline const CResourceFile* ResourceFile() const;
   1.245 +	//
   1.246 +private:
   1.247 +	void DoRunL();
   1.248 +	//
   1.249 +private:
   1.250 +	CResourceFile* iResourceFile;
   1.251 +	
   1.252 +	//
   1.253 +private:
   1.254 +	IMPORT_C virtual void CLogBase_Reserved1();
   1.255 +	TAny* CLogBase_Reserved;
   1.256 +	};
   1.257 +
   1.258 +//**********************************
   1.259 +// CLogWrapper
   1.260 +//**********************************
   1.261 +
   1.262 +/** 
   1.263 +The log wrapper.
   1.264 +
   1.265 +As some UI variants do not use a Log Engine, the log wrapper provides a consistent 
   1.266 +interface to clients that need to work, without being changed, with multiple 
   1.267 +UI variants.
   1.268 +
   1.269 +The log wrapper is provided in its own DLL, the logwrap.dll.
   1.270 +
   1.271 +If a Log Engine is not installed on a phone, the log wrapper creates an instance 
   1.272 +of the CLogBase class, whose event handling requests complete with KErrNotSupported 
   1.273 +and whose functions return KErrNotSupported.
   1.274 +
   1.275 +If a Log Engine is installed on a phone, the log wrapper creates an instance 
   1.276 +of the CLogClient class, provided in a separate DLL, the logcli.dll . The 
   1.277 +CLogClient class derives from CLogBase and provides implementations for the 
   1.278 +event handling requests and functions.
   1.279 +
   1.280 +@see CLogBase
   1.281 +@see CLogClient
   1.282 +@publishedAll
   1.283 +@released
   1.284 +*/
   1.285 +class CLogWrapper : public CBase
   1.286 +	{
   1.287 +public:
   1.288 +	IMPORT_C static CLogWrapper* NewL(RFs& aFs, TInt aPriority = CActive::EPriorityStandard);
   1.289 +	IMPORT_C ~CLogWrapper();
   1.290 +	//
   1.291 +	inline CLogBase& Log();
   1.292 +	IMPORT_C TBool ClientAvailable() const;
   1.293 +	//
   1.294 +private:
   1.295 +	CLogWrapper();
   1.296 +	void ConstructL(RFs& aFs, TInt aPriority);
   1.297 +	//
   1.298 +private:
   1.299 +	CLogBase* iBase;
   1.300 +	};
   1.301 +
   1.302 +#include <logwrap.inl>
   1.303 +#include <logeng.h>
   1.304 +
   1.305 +#endif