You Are Here:

Community: Developer Discussion Boards

#1 Old Question What is e32.callgate? - 2005-08-19, 02:09

Join Date: Aug 2005
Posts: 6
iccananea
Offline
Registered User
I learned of this function reading the API reference pdf. From what I understood, all I had to do was create a function and call e32.callgate passing it as an argument. That would execute the function as an active object in the thread. Here is my code:

Code:
import graphics
import e32

def snap():
    img = graphics.screenshot()
    img.save('e:\\photo.png', compression='fast')

fun = e32.ao_callgate(snap)
Contrary to my expectations, the function wasn´t called, not even when I called fun(). Calling dir(fun) returned an empty list. Calling type(e32.ao_callgate(snap)) returned type<e32_ao>

Ok, what is e32.callgate and how does it work?

Thanks in advance!
Reply With Quote

#2 Old 2005-08-22, 18:00

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
Calling fun() worked for me. Specifically, this script saved a screenshot:
Code:
import graphics
import e32

def snap():
    img = graphics.screenshot()
    img.save('e:\\photo.png', compression='fast')

fun = e32.ao_callgate(snap)
fun()
The ao_callgate is an object that queues the calls and parameters made, and when activated, calls the given function as many times as there are calls in the queue, with the parameters that were given, in the context of the thread where the ao_callgate was created.

The callgate is activated whenever the thread that owns the callgate runs the Active Scheduler. The Python for S60 libraries usually run the Active Scheduler whenever they are waiting for something. For example, Ao_lock's wait method, socket's recv method and e32.ao_sleep all run the Active Scheduler when they wait.

For those who are familiar with Symbian active objects, the ao_callgate is simply an active object that has a queue of calls and that runs all the calls in the queue in its RunL method.
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

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