All About Symbian - Nokia (S60) and Sony Ericsson (UIQ) smartphones unwrapped

  #1  
Old 11-03-2003, 04:53 AM
dashfly dashfly is offline
Registered User
 
Join Date: Feb 2003
Posts: 4
dashfly is on a distinguished road
Log Engine and Active Objects

Hello,

I'm hoping one of the veterans can help me out. I'm developing an application where I need to access the log engine. I'm trying to access some of the asynchronous functions such as SetRecentListL of the CLogViewRecent class. This obviously needs to be implemented as an active object but I'm running into problems. What's happening is that I access my request function HandleLog which makes the asynchronous request and so on. This happens when the appropiate selection is made from a menu. So the first time I access the menu nothing happens. It's the second time around when the event triggers and my popup displays. I don't know if this makes sense but below is my header and source code:

////////////////////////// header //////////////////////////
class CTest : public CActive
{
public:
static CTest* NewL();
void ConstructL();
virtual ~CTest();
void HandleLog();

private:
virtual void RunL();
virtual void DoCancel();

private:
CTest();
RTimer iTimer;

CLogClient* clc;
CLogViewRecent* clv;

RFs file;
TBool success;

};

////////////////////////// source //////////////////////////
#include "Test.h"

///////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CTest* CTest::NewL()
{
CTest* self = new(ELeave) CTest;
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop();
return self;
}

CTest::CTest():CActive(0)
{

}


void CTest::ConstructL()
{
CActiveScheduler::Add(this); // add to scheduler
}

CTest::~CTest()
{
Cancel();
}

void CTest::HandleLog()
{
__ASSERT_ALWAYS(!IsActive(), User::Panic(_L("CTest"), 1));
file.Connect();
clc = CLogClient::NewL(file);
clv = CLogViewRecent::NewL(*clc);
file.Close();
success = clv->SetRecentListL(KLogNullRecentList, iStatus);
SetActive();
}


void CTest::RunL()
{
if(success)
{
globalNote->ShowNoteL(EAknGlobalInformationNote, _L("success"));
} else {
globalNote->ShowNoteL(EAknGlobalInformationNote, _L("failure"));
}
CleanupStack::PopAndDestroy();
}

void CTest:oCancel()
{
}

Everything runs fine in the emulator and on the target device is just that the first time that HandleLog is called nothing happens. Then the next time I click on the menu my popups display. I know I'm missing something with the active object but I'm just not sure what. I would greatly appreciate any insight you may have.

Best regards,
Dennis
Ads
 

Bookmarks

Tags
active, engine, log, objects

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT. The time now is 10:06 PM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright Notes || Contact Us || Privacy Policy