CPeriodic, TCallBack not being called

Login to reply to this topic.
Thu, 2005-12-22 17:39
Joined: 2005-12-22
Forum posts: 2
Hello

I've been searching the forums without success.

I have created a EXE to implement a server that serves to a Java Midlet.
(like in midpjni project)

I have some function to be caled very couple of minutes so I've used CPeriodic to call the function

The CPeriodic and the callback function are encapsullated in a C Class:

the CPeriodic is created this way:

Code:
iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityStandard);
iConsole->Printf(_L("Timer UP"));
// once a minute
iPeriodicTimer->Start(60*1000000,60*1000000,TCallBack(CPeriodico::Period,this));

Code:
and the CallbackFunction:
TInt CPeriodico::Period(TAny * aPtr) // defined in h as static
{
((CPeriodico*)aPtr)->DoPeriodTask();
return TRUE;
}

void CPeriodico::DoPeriodTask()
{
TBuf8<256> dummy;
iConsole->Printf(_L("Time"));

if(iSignalCounter == iSignals) { // no han habido señales
KillGPRS(&dummy);
iConsole->Printf(_L("GPRS off\n"));
}
else{
iSignalCounter = iSignals;
iConsole->Printf(_L("alive\n"));
}
}

The VS .NET wizard already creates an Active Scheduler for my EXE. The code compiles and executes without aparent error but the callback is never executed

Did anyone see any error or what else I sould check in order to make this work?

regards

Thank-you

Fri, 2005-12-23 06:04
Joined: 2005-08-04
Forum posts: 128
Re: CPeriodic, TCallBack not being called
hi,
try
     return   FALSE;
instead of
     return TRUE;

bye
sunny;
  • Login to reply to this topic.