?

Log in

No account? Create an account
Turn your N95 into a Bluetooth GPS - Nick [entries|archive|friends|userinfo]
Nick

[ website | gagravarr.org ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Turn your N95 into a Bluetooth GPS [Dec. 3rd, 2007|10:59 pm]
Nick
This might seem like quite a crazy idea. Why would you want to turn you expensive Nokia N95 (or other internal gps enabled S60 phone) into a bluetooth gps, when a bluetooth gps only costs 30 odd quid? Well, my main reason is that I always have my phone on me, and often forget my bluetooth gps, so if I needed a BT gps (eg for some external navigation tool), then having my N95 wouldn't be enough.

So, I've written a pretty nifty python script to turn my N95 into a bluetooth GPS. It's powered by LocationRequester (.sis file for Python 1.4.x), so annoyingly you'll have to devcert sign everything (if you spot someone who works for symbian, please hit them with a clue bat).

The script itself is fairly simple. It starts up, connects to the location service, and starts trying to get a fix. From the menu, you can choose to either connect out to another bluetooth device, or accept an inbound connection over bluetooth. Either way, once you have an active bluetooth connection, it builds up NMEA sentences from the location data it receives, and streams them out over bluetooth.

So far, I have only tested it with nmea_info.py on the other end, but that does work just great. If your app doesn't work, then let me know what NMEA sentences it likes, and I'll add them in (since I have to build them by hand, I only went for the more common ones). Admitedly it is a little pointless to have my N95 running this code, then my 6630 running nmea_info connecting to it, but hey :)

You can download the code, and a sis file ready for devcert signing, from http://gagravarr.org/code/#s60_as_bt_gps. You'll need S60 Python 1.4.x, and a devcert signed copy of LocationRequestor. You'll also either need to devcert sign the s60_as_bt_gps sis file, or install s60_at_bt_gps.py and ensure that your python scripting shell is devcert signed.
link

Comments:
From: (Anonymous)
2007-12-07 10:51 am (UTC)

Very interesting but..

Hey, that looks very interesting but i have an Nokia N73 and an bluetooth GPS which i frequently use for OSM, but for long trips i always use TomTom and it ain't possible to use the bluetooth gps with two programs. But if you could write a script that either logs NMEA and then emulates an bluetooth gps again or splits the bluetooth gps in two virtual gps's i could. If you would be able to write something like this i would be very thankful.

Skywave
(Replies frozen) (Thread)
From: gagravarr
2007-12-07 10:55 am (UTC)

Re: Very interesting but..

If you just want something to read from one bluetooth connection (the gps), and send all the data on to multiple other accepted ones (another phone, tomtom etc), then that ought to be really easy for you to write. Probably about 30-40 lines of code :)
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2007-12-07 03:59 pm (UTC)

Re: Very interesting but..

Problem is that i can't code :P, but if it thats easy i really should try to learn some python to try it myself, thanks for the hint though
(Replies frozen) (Parent) (Thread)
From: gagravarr
2007-12-08 11:15 am (UTC)

Re: Very interesting but..

It's pretty easy to get started with :)

Two scripts (http://gagravarr.org/code/) to look at are show_nmea_location.py (connecting to a bluetooth gps, parsing the nmea sentences, showing stuff on screen) and s60_as_bt_gps.py (accepting connections over bluetooth, writing nmea stuff out).

You'd want to do multiple inbound bluetooth connections, pop any new connected sockets into an array, then have your nmea code write each sentence out to all the sockets each time it gets a new one.
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2007-12-24 05:39 pm (UTC)

n95 suddenly closing

Hi,

I've installed nmea_info on my n95 but it is working in a weird manner.
After opening the symbian program it runs well for 15 seconds and then closes itself.
Sometimes it works longer, even for more then 20 minutes.
As the symbian version is behaving weirdly, I started to try the nmea version for the python script shell.
Python and the shell are both signed with devcerts. But when I run the script I get this error on the line: "identify.gps"
I`ve also sent you an email on code@gagravarr.org ...

Thank you for any help,
Marco
(Replies frozen) (Thread)
From: gagravarr
2007-12-25 11:49 am (UTC)

Re: n95 suddenly closing

Do you get the same issue if you run it from the python shell?

If the whole of python crashes, not much I can do really. Python shouldn't crash, and in doing so, is taking all the error messages with it :(
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2007-12-25 09:53 pm (UTC)

Re: n95 suddenly closing

Hi,

Thanks for replying.
I)
I've uploaded nmea_info.py and geo_helper.py to the Python folder on the phone memory card.
The problem is that when I run nmea_info.py from the shell on the n95 I get the following error:

File "E:\private\2000b1a5\default.py", line 81, in menu_action f()
File "E:\private\2000b1a5\default.py", line 65, in query_and_exec execfile(script_list[index][1].encode(`utf-8`), script_namespace.namespace)
File "e:\python\nmea_info.py" line 2051, in ?
gps.identify_gps()
File "e:\python\nmea_info.py" line 1942, in identify_gps
for i in range(count):
MemoryError

You said you`ve tested it on a n95. Have you tested both the .sis version and the shell script one?
How have you installed the librarie geo_helper.py? Have you just copied to the Python folder on the phone or have you installed with a .sis file ?
I`m asking this because I think geo_helper might be the cause of this error on the shell, as I read on this thread http://discussion.forum.nokia.com/forum/showthread.php?t=92757 that it is not possible to just copy a py librarie to s60 3rd phones, what I was doing till now.
Do you have a .sis installer for geo_helper librarie, or could you put it on your website for download?
II) Also, I've not being able to run the script s60_as_bt_gps.py wich gives the same errors as above listed.
Do you have a self signed version of http://gagravarr.org/code/s60_as_bt_gps_v3_001_devcert.sis ?
III) I`ve seen some garbage data on the gps.log file. For example, one line with the longitude missing and mixed with the next line.
If the normal line is gms1,gsm2,gsm3,gsm4,gsm5,lat,long,time ; I`ve seen lines that looked like (but not limited to) gms1,gsm2,gsm3,gsm4,gsm5,lat,gms1,gsm2,gsm3,gsm4,gsm5,lat .

Thanks for your attention,
And congrats for this yousefull code.

Tks,
Marco
(Replies frozen) (Parent) (Thread)
From: gagravarr
2007-12-26 11:59 am (UTC)

Re: n95 suddenly closing

Never seen that error before. Looks to be coming from within the bowels of LocationRequestor though. Do you definately have the version for python 1.4.x installed, and not the 1.3.x version?

I do all my development by uploading the .py files into e:\python\, including the library files. You don't need a .sis of geo_helper.py, it comes as part of nmea_info .sis files, or you install it stand alone.

A self signed version of s60_as_bt_gps wouldn't be any use. It needs to be devcert signed to get at the gps.
(Replies frozen) (Parent) (Thread)
From: gpani
2008-01-04 12:29 pm (UTC)

Re: n95 suddenly closing

Nick,

I got exactly the same messages (MemoryError) on an E90 with
LocationRequester for 1.4.x installed.

Any idea, hint?

Many thanks,
Gerald
(Replies frozen) (Parent) (Thread)
From: gagravarr
2008-01-04 12:55 pm (UTC)

Re: n95 suddenly closing

Nothing springs to mind. I don't get anything like that on my N95, so I can't replicate it to investigate :(

Best bet might be to contact the LocationRequestor author, and see if he has any ideas about what might trigger it
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2008-01-14 09:36 pm (UTC)

Re: n95 suddenly closing

I also get the MemoryError. Not sure where to go from here...
(Replies frozen) (Parent) (Thread)
From: gagravarr
2008-01-14 10:45 pm (UTC)

Re: n95 suddenly closing

MemoryError is coming from within the bowels of python, so out of the hands of my code. You could try asking the s60 python guys for tips on debugging, but I suspect they're going to say it's a locationrequestor bug :(
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2008-02-08 10:40 am (UTC)

Re: n95 suddenly closing

N82 the same problem :(
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2008-02-08 06:13 pm (UTC)

Re: n95 suddenly closing

same problems on the n95
(Replies frozen) (Parent) (Thread)
From: ext_99514
2008-05-12 01:46 pm (UTC)

Re: n95 suddenly closing

same prob here... N95-1...

if you'd lik, I can re-create the error, lol, just by trying to run the app, and then give you the error code that Python spits out...

wernergvh@gmail.com
(Replies frozen) (Parent) (Thread)
From: gagravarr
2008-05-12 01:50 pm (UTC)

Re: n95 suddenly closing

It's not my code that's giving the error though. (The error comes from something my code calls)

It'll either be LocationRequestor, or s60 python itself, so you'll need to contact the appropriate people for those and see if they can help
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2008-05-20 07:53 am (UTC)

Re: n95 suddenly closing

Can you send me to my personnal email patrick92100 at yahoo dot fr
all the file I need to install in my N95 ... The file don't needs to be signed because I have the software to sign everything.

Thanks
(Replies frozen) (Parent) (Thread)
From: gagravarr
2008-05-20 08:00 am (UTC)

Re: n95 suddenly closing

It's all available to download from http://gagravarr.org/code/
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2008-05-21 09:41 am (UTC)

Re: n95 suddenly closing

How about an app which will make the internal gps seem like a bluetooth one so that applications which can only connect to a bluetooth gps can use it? Doable?

Thanks.
(Replies frozen) (Parent) (Thread)
From: gagravarr
2008-05-21 09:57 am (UTC)

Re: n95 suddenly closing

Umm, already done 6 months ago....

http://gagravarr.livejournal.com/134849.html
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2008-05-21 10:21 am (UTC)

Re: n95 suddenly closing

ummm... not quite what I meant. Here's a usage scenario to make things clear. Suppose you have an app on the phone which works by connecting to an external gps device only i.e it does not support the internal gps. I would like a way to make such an app use the internal gps on the same phone instead....maybe by having some virtual bluetooth device setup. Your 'already done' solution requires two hardware devices.

(Replies frozen) (Parent) (Thread)
From: gagravarr
2008-05-21 10:33 am (UTC)

Re: n95 suddenly closing

I'm pretty sure that the symbian bluetooth stack refuses to ever talk to itself :(

It's probably simpler to fix applications to use the internal gps than it would be to write an entire virtual bluetooth device to allow the phone to discover and connect to itself. That's not something you'd do in python though, so you'd need to find a hard-core symbian c++ hacker if you wanted to go down that route.
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2008-05-21 10:50 am (UTC)

Re: n95 suddenly closing

Ok. Thanks.
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2008-05-19 12:11 am (UTC)

You seen extgps yet?

Really like your python scripts. Just ordered an n95, haven't got it yet, but have you seen this http://www.nokiausers.net/Reviews/ExtGPS-Internal-GPS-Sharing-for-S60v3.html ?
(Replies frozen) (Thread)
From: (Anonymous)
2008-05-21 07:59 pm (UTC)

Re: You seen extgps yet?

I can confirm that EXTGPS works a charm - just used it to beam the nmea strings from my n95 to my n73. Here's a better link to the download site: http://tinyurl.com/5u3o6k

Sorry Nick, the advantage of this one is that it's a signed JAR so there's no faffing around with signing, locationrequestor, or even installing python...
(Replies frozen) (Parent) (Thread)
From: gagravarr
2008-05-22 09:31 am (UTC)

Re: You seen extgps yet?

Yeah, Nokia are quite shit like that, and make it so that if you won't pay them or one of their mates some "protection money" for all the signing stuff, it's a huge faff for all your users

Possibly the one thing my code has going for it is that it's open source, so you can customise it, and use it for free in situations where extgps wants money
(Replies frozen) (Parent) (Thread)
From: (Anonymous)
2008-07-18 04:20 am (UTC)

Alternative

Hello. Before finding this, I wrote something similar -- I added Bluetooth support to Barbelo GPSd. It should work on any phone with Java Location and Bluetooth support. If you or someone who's looking for this wants to have a look, here's a link: http://wiki.nomi.cz/gpsd:start
(Replies frozen) (Thread)