You Are Here:

Community: Developer Discussion Boards

#1 Old event based framework need ideas for impl. - 2008-01-27, 13:32

Join Date: Dec 2007
Posts: 8
acode
Offline
Registered User
Hello,

I want to make an event based framework where people extend a class and then get notified of different events such as incoming SMS, updated GPS coordinates,calls etc. So basicly Im thinking of doing a while(true) loop in the main class and then call the methods once a certain event has occurred. However Im afried that an while loop which does not sleep will take up too much power consumption....


Any ideas how I can just alert users of events with my framework? Can I tell python to call a certain method once an event occours? Then I would just be able to forward the event...
Reply With Quote

#2 Old Re: event based framework need ideas for impl. - 2008-01-27, 15:28

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by acode View Post
However Im afried that an while loop which does not sleep will take up too much power consumption....
Hi acode,

Well you can have delay in your While loop. Also for incoming sms you can call the function using bind. However you will have to use the delay in the function.
(e32.ao_sleep(0.1))
Quote:
i.bind(function)# Where i is an instant of inbox

Best Regards
Croozeus
Reply With Quote

#3 Old Re: event based framework need ideas for impl. - 2008-01-27, 21:58

Join Date: Dec 2007
Posts: 8
acode
Offline
Registered User
Thanks for your reply.

But I really dont want to use a delay as I want users of the framework to write code which can rely on their methods being invoked the milisec the event happens...

I guess what Im looking for is a way to get around using a while loop and instead be notified of different events that happen and then have my methods called when that even happen...

Like you mentioned yourself a bind method for incoming messages but then not just for messages also for when battery strength is 0, above 0, when power is almost out etc.

I guess what I am asking is how can I make these hooks?

Thanks in advance
Reply With Quote

#4 Old Re: event based framework need ideas for impl. - 2008-02-01, 15:47

Join Date: Jan 2004
Posts: 368
Location: Helsinki
Send a message via Skype™ to miohtama
miohtama's Avatar
miohtama
Offline
Regular Contributor
Quote:
Originally Posted by acode View Post
Thanks for your reply.

But I really dont want to use a delay as I want users of the framework to write code which can rely on their methods being invoked the milisec the event happens...

I guess what Im looking for is a way to get around using a while loop and instead be notified of different events that happen and then have my methods called when that even happen...

Like you mentioned yourself a bind method for incoming messages but then not just for messages also for when battery strength is 0, above 0, when power is almost out etc.

I guess what I am asking is how can I make these hooks?

Thanks in advance
You need to use callback methods (provided by inbox API?) and leave your main thread to rest in timer.after() method. When callback is called, release the main thread lock in the callback and then process the callback input in the main thread loop.


Mikko Ohtamaa
Twinapex Research
http://www.twinapex.com
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
XMPP based IM framework? masterchief2004 Mobile Java General 0 2007-10-12 12:00
why I can't send the key "1" event songlinhe General Symbian C++ 3 2007-05-30 09:05
New Wireless framework based on Jabber Protocol Afify Mobile Java General 0 2007-02-04 00:29
New Wireless framework based on Jabber Protocol Afify Mobile Java Tools & SDKs 0 2007-02-04 00:28
CLogEvent problem silviuccia General Symbian C++ 2 2006-12-22 16:28

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia