Nokia N810 as Bluetooth GPS dongle

Introduction

bt-gps is a wrapper script for making Nokia N810 running Maemo 4 (Diablo) to act as Bluetooth GPS dongle. Currently only command line interface exists.

Install for Diablo.

Usage

Using the script is easy. Once you have it installed, simply run bt-gps on the command line (“Terminal”). Once you’re done, press Ctrl-C. Note that you don’t need to turn on Bluetooth manually; the script will do that for you. Also, Bluetooth is automatically turned off when you quit (assuming the had to switch it on).

~ $ bt-gps
Enavling Bluetooth... connectable
Adding SP...
Serial Port service registered
Waiting for connection on channel 1

...

Removing SP...
Service Record deleted.
Searching for SP on FF:FF:FF:00:00:00 ...

How it works

The script itself if extremely simple: it simply enabled Bluetooth if needed, adds a serial profile, waits for connections and cleans everything(*) at the end.

100 REM -- ENABLE BLUETOOTH
110 SYS 16384: REM GET BLUETOOTH STATUS TO BT
120 SYS 16386: REM ADD BREAK HANDLER TO JUMP TO LINE 900
130 IF BT = 1 THEN GOTO 200
140 SYS 16388: REM ENABLE BLUETOOTH
200 REM -- ENABLE SERIAL PORT PROFILE
210 SYS 16390: REM ADD SERIAL PORT PROFILE
500 REM -- MAIN LOOP
510 CH = 1: REM USE CHANNEL 1
600 SYS 16392: REM WAIT FOR CLIENT AT CHANNEL CH, RETURN STATUS IN ER
610 IF ER = 1 THEN GOTO 700
620 SYS 16394: REM POKE GPSD
630 GOTO 500
700 REM -- CHANNEL IS BUSY
710 CH = CH + 1
720 GOTO 600
900 REM -- CLEANUP
910 SYS 16396: REM REMOVE SERIAL PORT PROFILE(S)
920 SYS 16398: REM RESTORE BLUETOOTH STATUS FROM BT
930 END

See the script (probably outdated).

Pitfalls

It is not uncommon for GPS status bar applet to stay visibe even when GPSr is no longer on. On some occasions it is also possible that GPSr will stay active even after all clients have disconnected. If this happens, you can run provided tool poke-gpsd to try to fix this. This application will create and stop an instance of gpsbt. If that doesn’t work, well, life is tough.

If Bluetooth was off when the script was started, Bluetooth will be turned off at shutdown regardless of number of devices connected over Bluetooth at that point. For example, if have have Bluetooth off before starting the script and establish an Internet connection over Bluetooth while running the script without, Bluetooth will be turned off when the script finishes.

Installation

Install for Diablo (using local repository).