sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <logcli.h>
|
sl@0
|
17 |
#include <logwraplimits.h>
|
sl@0
|
18 |
#include "logcntdef.h"
|
sl@0
|
19 |
#include "LOGGET.H"
|
sl@0
|
20 |
#include "LOGQUERY.H"
|
sl@0
|
21 |
#include "logservpanic.h"
|
sl@0
|
22 |
#include "LogServCacheStrings.h"
|
sl@0
|
23 |
#include "LogServCacheTypes.h"
|
sl@0
|
24 |
#include "LogServResourceInterpreter.h"
|
sl@0
|
25 |
#include "LogServDatabaseTransactionInterface.h"
|
sl@0
|
26 |
#include "LogServSqlStrings.h"
|
sl@0
|
27 |
|
sl@0
|
28 |
CLogGetEvent::CLogGetEvent(MLogServDatabaseTransactionInterface& aDatabase, TInt aPriority) :
|
sl@0
|
29 |
CLogActive(aPriority),
|
sl@0
|
30 |
iDatabase(aDatabase)
|
sl@0
|
31 |
{
|
sl@0
|
32 |
}
|
sl@0
|
33 |
|
sl@0
|
34 |
CLogGetEvent::~CLogGetEvent()
|
sl@0
|
35 |
{
|
sl@0
|
36 |
Cancel();
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
CLogGetEvent* CLogGetEvent::NewL(MLogServDatabaseTransactionInterface& aDatabase, TInt aPriority)
|
sl@0
|
40 |
{
|
sl@0
|
41 |
return new (ELeave) CLogGetEvent(aDatabase, aPriority);
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
void CLogGetEvent::StartL(CLogEvent& aEvent, TRequestStatus& aStatus, const RMessage2& aMessage)
|
sl@0
|
45 |
{
|
sl@0
|
46 |
LOGTEXT2("CLogGetEvent::StartL() - Id: %d", aEvent.Id());
|
sl@0
|
47 |
if(aEvent.Id() == KLogNullId)
|
sl@0
|
48 |
{
|
sl@0
|
49 |
::PanicClientL(aMessage, ELogNotValid);
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
RLogEventDbTable tbl;
|
sl@0
|
53 |
tbl.OpenLC(iDatabase.DTIDatabase());
|
sl@0
|
54 |
User::LeaveIfError(tbl.SetIndex(KLogNameEventIdx1));
|
sl@0
|
55 |
|
sl@0
|
56 |
if(!tbl.SeekL(TDbSeekKey((TInt)aEvent.Id())))
|
sl@0
|
57 |
{
|
sl@0
|
58 |
User::Leave(KErrNotFound);
|
sl@0
|
59 |
}
|
sl@0
|
60 |
|
sl@0
|
61 |
tbl.GetL();
|
sl@0
|
62 |
|
sl@0
|
63 |
TLogTypeId logTypeId = tbl.ColInt16(RLogEventDbTable::iTypeColNo);
|
sl@0
|
64 |
const TLogServCacheTypeEntry& entry = iDatabase.DTICacheTypes().FindById(logTypeId);
|
sl@0
|
65 |
if(!iDatabase.DTIIsAllowed(EReadOp, aMessage, entry.iEventType->Uid()))
|
sl@0
|
66 |
{
|
sl@0
|
67 |
User::Leave(KErrPermissionDenied);
|
sl@0
|
68 |
}
|
sl@0
|
69 |
aEvent.SetEventType(entry.iEventType->Uid());
|
sl@0
|
70 |
aEvent.SetDescription(entry.iEventType->Description());
|
sl@0
|
71 |
|
sl@0
|
72 |
TLogStringId directionId = tbl.IsColNull(RLogEventDbTable::iDirectionColNo) ? KLogNullStringId : tbl.ColInt16(RLogEventDbTable::iDirectionColNo);
|
sl@0
|
73 |
aEvent.SetDirection(iDatabase.DTICacheStrings().FindString(directionId));
|
sl@0
|
74 |
|
sl@0
|
75 |
TLogStringId statusId = tbl.IsColNull(RLogEventDbTable::iStatusColNo) ? KLogNullStringId : tbl.ColInt16(RLogEventDbTable::iStatusColNo);
|
sl@0
|
76 |
aEvent.SetStatus(iDatabase.DTICacheStrings().FindString(statusId));
|
sl@0
|
77 |
|
sl@0
|
78 |
aEvent.SetRemoteParty(tbl.ColDes(RLogEventDbTable::iRemotePartyColNo));
|
sl@0
|
79 |
aEvent.SetTime(tbl.ColTime(RLogEventDbTable::iTimeColNo));
|
sl@0
|
80 |
aEvent.SetDurationType(tbl.IsColNull(RLogEventDbTable::iDurationTypeColNo) ? KLogNullDurationType : tbl.ColInt8(RLogEventDbTable::iDurationTypeColNo));
|
sl@0
|
81 |
aEvent.SetDuration(tbl.ColUint32(RLogEventDbTable::iDurationColNo));
|
sl@0
|
82 |
aEvent.SetSubject(tbl.ColDes(RLogEventDbTable::iSubjectColNo));
|
sl@0
|
83 |
aEvent.SetNumber(tbl.ColDes(RLogEventDbTable::iNumberColNo));
|
sl@0
|
84 |
aEvent.SetContact(tbl.IsColNull(RLogEventDbTable::iContactColNo) ? KLogNullContactId : tbl.ColInt32(RLogEventDbTable::iContactColNo));
|
sl@0
|
85 |
aEvent.SetLink(tbl.ColUint32(RLogEventDbTable::iLinkColNo));
|
sl@0
|
86 |
if(tbl.IsColNull(RLogEventDbTable::iDataColNo))
|
sl@0
|
87 |
{
|
sl@0
|
88 |
aEvent.SetDataL(KNullDesC8);
|
sl@0
|
89 |
}
|
sl@0
|
90 |
else
|
sl@0
|
91 |
{
|
sl@0
|
92 |
RDbColReadStream stream;
|
sl@0
|
93 |
stream.OpenLC(tbl, RLogEventDbTable::iDataColNo);
|
sl@0
|
94 |
aEvent.SetDataL(stream, tbl.ColLength(RLogEventDbTable::iDataColNo));
|
sl@0
|
95 |
CleanupStack::PopAndDestroy(&stream);
|
sl@0
|
96 |
}
|
sl@0
|
97 |
|
sl@0
|
98 |
aEvent.ClearFlags(KLogFlagsMask);
|
sl@0
|
99 |
for(TInt i=0;i<KLogFlagsCount;++i)
|
sl@0
|
100 |
{
|
sl@0
|
101 |
aEvent.SetFlags((TLogFlags)(tbl.ColUint8(RLogEventDbTable::iFlagColNo[i]) ? 0x1 << i : 0));
|
sl@0
|
102 |
}
|
sl@0
|
103 |
|
sl@0
|
104 |
#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
|
sl@0
|
105 |
aEvent.SetSimId(tbl.ColUint32(RLogEventDbTable::iSimIdColNo));
|
sl@0
|
106 |
#endif
|
sl@0
|
107 |
|
sl@0
|
108 |
CleanupStack::PopAndDestroy(&tbl);
|
sl@0
|
109 |
|
sl@0
|
110 |
TRequestStatus* st = &aStatus;
|
sl@0
|
111 |
User::RequestComplete(st, KErrNone);
|
sl@0
|
112 |
LOGTEXT("CLogGetEvent::StartL() - end");
|
sl@0
|
113 |
}
|
sl@0
|
114 |
|
sl@0
|
115 |
//CLogGetEvent::StartL() does all job
|
sl@0
|
116 |
#pragma BullseyeCoverage off
|
sl@0
|
117 |
|
sl@0
|
118 |
void CLogGetEvent::DoRunL()
|
sl@0
|
119 |
{
|
sl@0
|
120 |
LOGTEXT("CLogGetEvent::DoRunL() - begin");
|
sl@0
|
121 |
__ASSERT_DEBUG(0, User::Invariant());
|
sl@0
|
122 |
LOGTEXT("CLogGetEvent::DoRunL() - end");
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
#pragma BullseyeCoverage on
|