os/persistentdata/loggingservices/eventlogger/LogServ/src/LOGGET.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <logcli.h>
    17 #include <logwraplimits.h>
    18 #include "logcntdef.h"
    19 #include "LOGGET.H"
    20 #include "LOGQUERY.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"
    27 
    28 CLogGetEvent::CLogGetEvent(MLogServDatabaseTransactionInterface& aDatabase, TInt aPriority) :
    29     CLogActive(aPriority),
    30     iDatabase(aDatabase)
    31 	{
    32 	}
    33 
    34 CLogGetEvent::~CLogGetEvent()
    35 	{
    36 	Cancel();
    37 	}
    38 
    39 CLogGetEvent* CLogGetEvent::NewL(MLogServDatabaseTransactionInterface& aDatabase, TInt aPriority)
    40 	{
    41 	return new (ELeave) CLogGetEvent(aDatabase, aPriority);
    42 	}
    43 
    44 void CLogGetEvent::StartL(CLogEvent& aEvent, TRequestStatus& aStatus, const RMessage2& aMessage)
    45 	{
    46 	LOGTEXT2("CLogGetEvent::StartL() - Id: %d", aEvent.Id());
    47 	if(aEvent.Id() == KLogNullId)
    48 		{
    49 		::PanicClientL(aMessage, ELogNotValid);
    50 		}
    51 	
    52     RLogEventDbTable tbl;
    53     tbl.OpenLC(iDatabase.DTIDatabase());
    54     User::LeaveIfError(tbl.SetIndex(KLogNameEventIdx1));
    55 
    56     if(!tbl.SeekL(TDbSeekKey((TInt)aEvent.Id())))
    57         {
    58         User::Leave(KErrNotFound);
    59         }
    60     
    61     tbl.GetL();
    62     
    63     TLogTypeId logTypeId = tbl.ColInt16(RLogEventDbTable::iTypeColNo);
    64     const TLogServCacheTypeEntry& entry = iDatabase.DTICacheTypes().FindById(logTypeId);
    65     if(!iDatabase.DTIIsAllowed(EReadOp, aMessage, entry.iEventType->Uid()))
    66         {
    67         User::Leave(KErrPermissionDenied);
    68         }
    69     aEvent.SetEventType(entry.iEventType->Uid());
    70     aEvent.SetDescription(entry.iEventType->Description());
    71     
    72     TLogStringId directionId = tbl.IsColNull(RLogEventDbTable::iDirectionColNo) ? KLogNullStringId : tbl.ColInt16(RLogEventDbTable::iDirectionColNo);
    73     aEvent.SetDirection(iDatabase.DTICacheStrings().FindString(directionId));
    74     
    75     TLogStringId statusId = tbl.IsColNull(RLogEventDbTable::iStatusColNo) ? KLogNullStringId : tbl.ColInt16(RLogEventDbTable::iStatusColNo);
    76     aEvent.SetStatus(iDatabase.DTICacheStrings().FindString(statusId));
    77 	
    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))
    87         {
    88         aEvent.SetDataL(KNullDesC8);
    89         }
    90     else
    91         {
    92         RDbColReadStream stream;
    93         stream.OpenLC(tbl, RLogEventDbTable::iDataColNo);
    94         aEvent.SetDataL(stream, tbl.ColLength(RLogEventDbTable::iDataColNo));
    95         CleanupStack::PopAndDestroy(&stream);
    96         }
    97     
    98     aEvent.ClearFlags(KLogFlagsMask);
    99     for(TInt i=0;i<KLogFlagsCount;++i)
   100         {
   101         aEvent.SetFlags((TLogFlags)(tbl.ColUint8(RLogEventDbTable::iFlagColNo[i]) ? 0x1 << i : 0));
   102         }
   103     
   104 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   105     aEvent.SetSimId(tbl.ColUint32(RLogEventDbTable::iSimIdColNo));
   106 #endif    
   107     
   108     CleanupStack::PopAndDestroy(&tbl);
   109     
   110     TRequestStatus* st = &aStatus;
   111     User::RequestComplete(st, KErrNone);
   112 	LOGTEXT("CLogGetEvent::StartL() - end");
   113 	}
   114 
   115 //CLogGetEvent::StartL() does all job
   116 #pragma BullseyeCoverage off
   117 
   118 void CLogGetEvent::DoRunL()
   119 	{
   120 	LOGTEXT("CLogGetEvent::DoRunL() - begin");
   121 	__ASSERT_DEBUG(0, User::Invariant());
   122 	LOGTEXT("CLogGetEvent::DoRunL() - end");
   123 	}
   124 
   125 #pragma BullseyeCoverage on