Strange problem with my code. Instead of doing anything it just quits python completely.
This is the code i'm trying to get to work:
Code:
import httplib, e32, positioning, urllib, appuifw, positioning, sysinfo
def gps_init():
try:
positioning.select_module(positioning.default_module())
positioning.set_requestors([{"type":"service","format":"application","data":"test_app"}])
positioning.position(course=1,satellites=1,callback=gps,interval=500000,partial=0)
e32.ao_sleep(3)
except:
appuifw.note(u'Problem med GPS','error')
def gps_stop():
try:
positioning.stop_position()
except:
appuifw.note(u'GPS stoppet','error')
def gps_print():
lokasjon = str('Min GPS posisjon er (Lengdegrad/Breddegrad) : %s, %s, %i' % (pos_lat, pos_long) )
print lokasjon
e32.ao_sleep(10)
def open_browser(url):
url = "%s?%s" % ('http://www.example.com/mobil/upload.php', urllib.urlencode({'lat': pos_lat, 'lon': pos_long}),)
e32.start_exe('BrowserNG.exe', ' "4 %s 1"' % url, 1)
gps_init()
count = 0
while True:
count = count + 1
sat = gps_data['satellites']['used_satellites']
pos_lat = gps_data['position']['latitude']
pos_long = gps_data['position']['longitude']
if pos_lat > 0:
gps_print()
print 'Fant GPS posisjon, åpner Lokanytt...'
open_browser(url)
e32.ao_sleep(1)