hello people, is there any trick for solving racing condition problems involving positioning module? In the following code im getting NameError :global name 'e' is not defined. it seems this line "canvas.text( (2,12), unicode(str(e["latitude"])))" is called before my internal gps gives my position (it takes like 30 seconds), is there any way of making this work?
i also tried adding "the normal" applicatin body to stop and wait for exist but im having the same racing condition problem...
any hint would be appreciated.
thanks
Code:from graphics import * import appuifw import e32 import positioning appuifw.app.screen='normal' appuifw.app.title=unicode('My Test App') canvas=appuifw.Canvas() appuifw.app.body=canvas positioning.select_module(positioning.default_module()) positioning.set_requestors([{"type":"service", "format":"application", "data":"test_app"}]) def cb(event): global e e = event["position"] d= positioning.position(course=1,satellites=1,callback=cb, interval=500000,partial=0) canvas.clear() canvas.text( (2,12), unicode(str(e["latitude"]))) canvas.text( (2,24), unicode(str(e["longitude"]))) e32.ao_yield() e32.ao_sleep(1115)

Reply With Quote


