First public contribution.
1 // Copyright (c) 2002-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include <logwraplimits.h>
18 #include "logcntdef.h"
21 #include "logservpanic.h"
22 #include "LogServCacheStrings.h"
23 #include "LogServCacheTypes.h"
24 #include "LogServResourceInterpreter.h"
25 #include "LogServDatabaseTransactionInterface.h"
26 #include "LogServSqlStrings.h"
28 CLogGetEvent::CLogGetEvent(MLogServDatabaseTransactionInterface& aDatabase, TInt aPriority) :
29 CLogActive(aPriority),
34 CLogGetEvent::~CLogGetEvent()
39 CLogGetEvent* CLogGetEvent::NewL(MLogServDatabaseTransactionInterface& aDatabase, TInt aPriority)
41 return new (ELeave) CLogGetEvent(aDatabase, aPriority);
44 void CLogGetEvent::StartL(CLogEvent& aEvent, TRequestStatus& aStatus, const RMessage2& aMessage)
46 LOGTEXT2("CLogGetEvent::StartL() - Id: %d", aEvent.Id());
47 if(aEvent.Id() == KLogNullId)
49 ::PanicClientL(aMessage, ELogNotValid);
53 tbl.OpenLC(iDatabase.DTIDatabase());
54 User::LeaveIfError(tbl.SetIndex(KLogNameEventIdx1));
56 if(!tbl.SeekL(TDbSeekKey((TInt)aEvent.Id())))
58 User::Leave(KErrNotFound);
63 TLogTypeId logTypeId = tbl.ColInt16(RLogEventDbTable::iTypeColNo);
64 const TLogServCacheTypeEntry& entry = iDatabase.DTICacheTypes().FindById(logTypeId);
65 if(!iDatabase.DTIIsAllowed(EReadOp, aMessage, entry.iEventType->Uid()))
67 User::Leave(KErrPermissionDenied);
69 aEvent.SetEventType(entry.iEventType->Uid());
70 aEvent.SetDescription(entry.iEventType->Description());
72 TLogStringId directionId = tbl.IsColNull(RLogEventDbTable::iDirectionColNo) ? KLogNullStringId : tbl.ColInt16(RLogEventDbTable::iDirectionColNo);
73 aEvent.SetDirection(iDatabase.DTICacheStrings().FindString(directionId));
75 TLogStringId statusId = tbl.IsColNull(RLogEventDbTable::iStatusColNo) ? KLogNullStringId : tbl.ColInt16(RLogEventDbTable::iStatusColNo);
76 aEvent.SetStatus(iDatabase.DTICacheStrings().FindString(statusId));
78 aEvent.SetRemoteParty(tbl.ColDes(RLogEventDbTable::iRemotePartyColNo));
79 aEvent.SetTime(tbl.ColTime(RLogEventDbTable::iTimeColNo));
80 aEvent.SetDurationType(tbl.IsColNull(RLogEventDbTable::iDurationTypeColNo) ? KLogNullDurationType : tbl.ColInt8(RLogEventDbTable::iDurationTypeColNo));
81 aEvent.SetDuration(tbl.ColUint32(RLogEventDbTable::iDurationColNo));
82 aEvent.SetSubject(tbl.ColDes(RLogEventDbTable::iSubjectColNo));
83 aEvent.SetNumber(tbl.ColDes(RLogEventDbTable::iNumberColNo));
84 aEvent.SetContact(tbl.IsColNull(RLogEventDbTable::iContactColNo) ? KLogNullContactId : tbl.ColInt32(RLogEventDbTable::iContactColNo));
85 aEvent.SetLink(tbl.ColUint32(RLogEventDbTable::iLinkColNo));
86 if(tbl.IsColNull(RLogEventDbTable::iDataColNo))
88 aEvent.SetDataL(KNullDesC8);
92 RDbColReadStream stream;
93 stream.OpenLC(tbl, RLogEventDbTable::iDataColNo);
94 aEvent.SetDataL(stream, tbl.ColLength(RLogEventDbTable::iDataColNo));
95 CleanupStack::PopAndDestroy(&stream);
98 aEvent.ClearFlags(KLogFlagsMask);
99 for(TInt i=0;i<KLogFlagsCount;++i)
101 aEvent.SetFlags((TLogFlags)(tbl.ColUint8(RLogEventDbTable::iFlagColNo[i]) ? 0x1 << i : 0));
104 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
105 aEvent.SetSimId(tbl.ColUint32(RLogEventDbTable::iSimIdColNo));
108 CleanupStack::PopAndDestroy(&tbl);
110 TRequestStatus* st = &aStatus;
111 User::RequestComplete(st, KErrNone);
112 LOGTEXT("CLogGetEvent::StartL() - end");
115 //CLogGetEvent::StartL() does all job
116 #pragma BullseyeCoverage off
118 void CLogGetEvent::DoRunL()
120 LOGTEXT("CLogGetEvent::DoRunL() - begin");
121 __ASSERT_DEBUG(0, User::Invariant());
122 LOGTEXT("CLogGetEvent::DoRunL() - end");
125 #pragma BullseyeCoverage on