NotifyDataAvailable() in RComm & RunL() not working
| Thu, 2008-02-28 15:20 | |
|
Greetings newLC members, I will be thankful if you please help me to resolve the following problem. //SerialListener.hYour suggestions are welcome. With Kind regards |
|






Forum posts: 132
Presumably this isn't a GUI app so have you started the active schuduler?
Forum posts: 10
Thanks for reply Numpty Alert,
I am calling above active object from the console application & i have installed the Active Scheduler.
The calling code is shown below.
LOCAL_C void DoStartL()
{
// Create active scheduler (to run active objects)
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
CleanupStack::PushL(scheduler);
CActiveScheduler::Install(scheduler);
CSerialListener* iSerialListener= CSerialListener::NewLC();
iSerialListener->InitializeL();
iSerialListener->StartListenerL();
for(;;)
{
User::After(1000000);
}
// Delete serial Listener & active scheduler
CleanupStack::PopAndDestroy(2);
}
GLDEF_C TInt E32Main()
{
// Create cleanup stack
__UHEAP_MARK;
CTrapCleanup* cleanup = CTrapCleanup::New();
TRAPD(mainError, DoStartL());
delete cleanup;
__UHEAP_MARKEND;
return KErrNone;
}
RunL() is not being called when th data is available.
If there is anything wrong then please help me.
Forum posts: 132
I didn't say have you installed an active scheduler, I said have you started one.
P.S.
What on earth is this?
for(;;)
{
User::After(1000000);
}
I think you had better read item number 8:
http://www.newlc.com/topic-13580
Forum posts: 10
Thanks Numpty,
I have seen the link and it is very helpful for all members.
I don't want to Start the active scheduler because i have to
execute another code statements inside my loop...
for(;;)
{
//Program statements
User::After(1000000);
}
I just want to be notified when the data is available & handle this data
in RunL() and if data is not available above loop statements will perform
their function.
I think this is possible but code never enters RunL().
What may be the reason?
Forum posts: 132
In the same sentence you said you don't want to start the active scheduler and your RunL doesn't enter.
You can't have your cake and eat it.
Reread that post, you have got to stop thinking in terms of loops and realise you are writing for a real time system. If you have to write a loop you have done something wrong.
Forum posts: 10
I realized my mistake, all works well when i started my Active Scheduler.
Thanks for your kind help.
Forum posts: 2
How did you start your Active Scheduler?
I don't understand too,could you give more detail?
Thanks!