Hi,

I'd also like to use my gta02 as bluetooth GPS with Android(Replicant)
devices.

There is an application for that in FDroid(a free software market/google
play replacement that contains only free software):
http://f-droid.org/repository/browse/?fdcategory=Navigation&fdid=org.broeuschmeul.android.gps.bluetooth.provider
The application is called BlueGPS

I've tried to make an up to date python application for the freerunner
from scratch...

But my application is not reliable at all:
-> it can only be closed by a kill (because of the while True: at the
end), I did the while true because rfcomm was not always reliable at
the beginning, maybe I should restest without it...
-> bluez is somehow unreliable and it doesn't always find the adapter.

So to use it, install Fdroid, then BlueGPS within Fdroid.
then run my gps script.
Then do that on the freerunner:
wget
http://git.kernel.org/cgit/bluetooth/bluez.git/plain/test/simple-agent?id=910ffb4ca785da71b670bf105e234435c67fd7fe
-O simple-agent
chmod +x simple-agent
./simple-agent

That will permit you to pair it with android...
you'll have to enter a pin on android and in simple-agent...

Denis.
#! /usr/bin/env python2

#Copyright (C) 2013  Denis 'GNUtoo' Carikli <gnu...@no-log.org>
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

import dbus
import os
import subprocess
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)

bus = dbus.SystemBus()

usage_obj = bus.get_object('org.freesmartphone.ousaged', '/org/freesmartphone/Usage')
usage_iface = dbus.Interface(usage_obj, 'org.freesmartphone.Usage')

usage_iface.RequestResource("Bluetooth")
usage_iface.RequestResource("CPU")
usage_iface.RequestResource("GPS")


try:
	pid = subprocess.check_output("pidof bluetoothd", shell=True).replace('\n','')
except:
	os.system("bluetoothd")
	pid = subprocess.check_output("pidof bluetoothd", shell=True).replace('\n','')

print "the bluez pid is " + pid

bluez_obj = bus.get_object('org.bluez', "/org/bluez/{0}/hci0".format(pid))
bluez_adapter_iface = dbus.Interface(bluez_obj, 'org.bluez.Adapter')

bluez_adapter_iface.SetProperty("Discoverable", True)

while True:
	try:
		os.system("rfcomm watch /dev/rfcomm0 1 sh -c \"gpspipe -r > /dev/rfcomm0\"")
	except KeyboardInterrupt:
		os.system("killall rfcomm")
		exit(0)
_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community

Reply via email to