×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    8

    event based framework need ideas for impl.

    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...

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,796

    Re: event based framework need ideas for impl.

    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))
    i.bind(function)# Where i is an instant of inbox

    Best Regards
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    8

    Re: event based framework need ideas for impl.

    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

  4. #4
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Helsinki
    Posts
    376

    Re: event based framework need ideas for impl.

    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

    http://mfabrik.com
    http://blog.mfabrik.com

Similar Threads

  1. XMPP based IM framework?
    By masterchief2004 in forum Mobile Java General
    Replies: 0
    Last Post: 2007-10-12, 11:00
  2. why I can't send the key "1" event
    By songlinhe in forum Symbian
    Replies: 3
    Last Post: 2007-05-30, 08:05
  3. New Wireless framework based on Jabber Protocol
    By Afify in forum Mobile Java General
    Replies: 0
    Last Post: 2007-02-03, 23:29
  4. New Wireless framework based on Jabber Protocol
    By Afify in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2007-02-03, 23:28
  5. CLogEvent problem
    By silviuccia in forum Symbian
    Replies: 2
    Last Post: 2006-12-22, 15:28

Posting Permissions

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