Hi, I'm writing application witch will using external GPS. I need one thread which will read GPS info about my position and send it somewhere.
I'm using this simple code for reading GPS data:
It works great, but problem is when i'm going to use get_position function as external thread like this:
import socket, btsocket, e32, appuifw, thread
address, services = btsocket.bt_discover()
gps_receiver = (address, services.values()) #select external bt gps receiver
connection = btsocket.socket(btsocket.AF_BT, btsocket.SOCK_STREAM)
ch = connection.recv(1)
gps_data = ""
while ch!='\n' :
if gps_data.startswith("$GPGGA"): #check if gps_data is valid NMEA sentence
gps_data = gps_data.split(",")
print "your position is %s, %s" % (gps_data, gps_data)
connection = init_gps_device()
position = get_position()
In this case my phone nokia E51 hung! I have no idea what can be wrong :/