summaryrefslogtreecommitdiff
path: root/packages/tangogps
diff options
context:
space:
mode:
authorDaniel Willmann <daniel@totalueberwachung.de>2008-07-28 20:38:38 +0000
committerDaniel Willmann <daniel@totalueberwachung.de>2008-07-28 20:38:38 +0000
commit07dca941ed9e6d6fc121d9ceb949f42b9a58daf4 (patch)
tree0c01d891182d4401faddf9a127c153e9fdfcea9e /packages/tangogps
parent3ccda8bedb75a5717bdeb89ae7ccd5db8235b876 (diff)
tangogps-fso_0.9.2.bb: Add a tangogps version with experimental patches that
support ogpsd. This will hopefully be merged once the Gypsy API is completely supported.
Diffstat (limited to 'packages/tangogps')
-rw-r--r--packages/tangogps/files/.mtn2git_empty0
-rw-r--r--packages/tangogps/files/0002-Get-GPS-data-via-the-gypsy-interface.patch182
-rw-r--r--packages/tangogps/files/0003-Try-to-request-the-GPS-resource-from-ousaged.patch73
-rw-r--r--packages/tangogps/tangogps-fso_0.9.2.bb13
4 files changed, 268 insertions, 0 deletions
diff --git a/packages/tangogps/files/.mtn2git_empty b/packages/tangogps/files/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/tangogps/files/.mtn2git_empty
diff --git a/packages/tangogps/files/0002-Get-GPS-data-via-the-gypsy-interface.patch b/packages/tangogps/files/0002-Get-GPS-data-via-the-gypsy-interface.patch
new file mode 100644
index 0000000000..d5b673dfca
--- /dev/null
+++ b/packages/tangogps/files/0002-Get-GPS-data-via-the-gypsy-interface.patch
@@ -0,0 +1,182 @@
+From aab817f5f2d66f1ef1e710eb6b698865d14b7fc2 Mon Sep 17 00:00:00 2001
+From: Daniel Willmann <daniel@totalueberwachung.de>
+Date: Mon, 21 Jul 2008 04:33:59 +0200
+Subject: [PATCH] Get GPS data via the gypsy interface.
+ Except for the time (which ogpsd doesn't send periodically) the interface
+ is implemented.
+
+---
+ configure.in | 2 +-
+ src/gps_functions.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ src/gps_functions.h | 3 +-
+ src/init.c | 6 ++-
+ 4 files changed, 103 insertions(+), 4 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 3661a57..cf06033 100644
+--- a/configure.in
++++ b/configure.in
+@@ -23,7 +23,7 @@ AM_GLIB_GNU_GETTEXT
+
+ AM_PROG_LIBTOOL
+
+-PKG_CHECK_MODULES(PACKAGE, [gtk+-2.0 gdk-2.0 gconf-2.0])
++PKG_CHECK_MODULES(PACKAGE, [gtk+-2.0 gdk-2.0 gconf-2.0 gypsy])
+ AC_SUBST(PACKAGE_CFLAGS)
+ AC_SUBST(PACKAGE_LIBS)
+
+diff --git a/src/gps_functions.c b/src/gps_functions.c
+index bafbc18..57646e1 100644
+--- a/src/gps_functions.c
++++ b/src/gps_functions.c
+@@ -4,6 +4,13 @@
+ # include <config.h>
+ #endif
+
++#include <gypsy/gypsy-control.h>
++#include <gypsy/gypsy-device.h>
++#include <gypsy/gypsy-position.h>
++#include <gypsy/gypsy-accuracy.h>
++#include <gypsy/gypsy-course.h>
++#include <gypsy/gypsy-satellite.h>
++
+ #include <glib.h>
+ #include <glib/gprintf.h>
+
+@@ -630,3 +637,92 @@ get_gps()
+
+
+ }
++
++static void on_fix_status_changed(GypsyDevice *device, GypsyDeviceFixStatus status, void *user_data)
++{
++ gpsdata->fix.mode = status;
++ gpsdata->valid = status > 1;
++}
++
++static void on_position_changed(GypsyPosition *position, GypsyPositionFields fields_set,
++ int timestamp, double latitude, double longitude, double altitude, void *user_data)
++{
++ if (gpsdata->valid) {
++ gpsdata->fix.latitude = latitude;
++ gpsdata->fix.longitude = longitude;
++ gpsdata->fix.altitude = altitude;
++ }
++}
++
++static void on_accuracy_changed(GypsyAccuracy *accuracy, int fields, double pdop,
++ double hdop, double vdop, void *user_data)
++{
++ gpsdata->hdop = hdop;
++}
++
++static void on_course_changed(GypsyCourse *course, GypsyCourseFields fields_set,
++ int timestamp, double speed, double direction, double climb, void *user_data)
++{
++ gpsdata->fix.speed = speed/3.6;
++ gpsdata->fix.track = direction;
++}
++
++static void on_satellites_changed(GypsySatellite *sat, GPtrArray *sats, void *user_data)
++{
++ int i;
++
++ gpsdata->satellites_used = 0;
++ gpsdata->satellites_inview = sats->len;
++ for (i = 0; i < sats->len; i++) {
++ GypsySatelliteDetails *details = sats->pdata[i];
++
++ if (details->in_use) {
++ gpsdata->satellites_used++;
++ }
++ }
++}
++
++// typedef struct {
++// double time; /* Time of update, seconds since Unix epoch */
++// int mode; /* Mode of fix */
++// double latitude; /* Latitude in degrees (valid if mode >= 2) */
++// double longitude; /* Longitude in degrees (valid if mode >= 2) */
++// double altitude; /* Altitude in meters (valid if mode == 3) */
++// double track; /* Course made good (relative to true north) */
++// double speed; /* Speed over ground, meters/sec */
++// double bearing; /* in radian */
++// } gps_fix_t;
++//
++// typedef struct {
++// gps_fix_t fix;
++// int satellites_used;
++// int satellites_inview;
++// double hdop;
++// gboolean valid;
++// } gps_data_t;
++
++
++#define GYPSY_OBJ_PATH "/org/freedesktop/Gypsy"
++
++int setup_gypsy() {
++ gpsdata = g_new0(gps_data_t,1);
++
++ GypsyControl *gyctrl = gypsy_control_get_default();
++ GypsyDevice *gydevice = gypsy_device_new(GYPSY_OBJ_PATH);
++ GypsyPosition *gypos = gypsy_position_new(GYPSY_OBJ_PATH);
++ GypsyAccuracy *gyacc = gypsy_accuracy_new(GYPSY_OBJ_PATH);
++ GypsyCourse *gycourse = gypsy_course_new(GYPSY_OBJ_PATH);
++ GypsySatellite *gysat = gypsy_satellite_new(GYPSY_OBJ_PATH);
++
++ g_signal_connect(gydevice, "fix-status-changed", G_CALLBACK(on_fix_status_changed), NULL);
++ g_signal_connect(gypos, "position-changed", G_CALLBACK(on_position_changed), NULL);
++ g_signal_connect(gyacc, "accuracy-changed", G_CALLBACK(on_accuracy_changed), NULL);
++ g_signal_connect(gycourse, "course-changed", G_CALLBACK(on_course_changed), NULL);
++ g_signal_connect(gysat, "satellites-changed", G_CALLBACK(on_satellites_changed), NULL);
++
++ gpsdata->fix.mode = gypsy_device_get_fix_status(gydevice, NULL);
++ gpsdata->valid = gpsdata->fix.mode > 1;
++
++ return 1;
++}
++
+diff --git a/src/gps_functions.h b/src/gps_functions.h
+index 1090565..207b39f 100644
+--- a/src/gps_functions.h
++++ b/src/gps_functions.h
+@@ -1,4 +1,5 @@
+-
++int
++setup_gypsy();
+
+ void
+ get_gps();
+diff --git a/src/init.c b/src/init.c
+index 46ca583..c557ce4 100644
+--- a/src/init.c
++++ b/src/init.c
+@@ -26,7 +26,7 @@
+ #include "wp.h"
+
+ FILE *fp = NULL;
+-
++int have_gypsy = 0;
+
+
+ void
+@@ -197,7 +197,8 @@ cb_gps_timer()
+
+ printf("timer called\n");
+
+- get_gps();
++ if (!have_gypsy)
++ get_gps();
+
+
+ if(gpsdata)
+@@ -868,5 +869,6 @@ init()
+ gtk_label_set_text(GTK_LABEL(widget), "V: " VERSION " (C) Marcus Bauer, GPLv2");
+ #endif
+
++ have_gypsy = setup_gypsy();
+ timer = g_timeout_add (1000,cb_gps_timer,data);
+ }
+--
+1.5.4.5
+
diff --git a/packages/tangogps/files/0003-Try-to-request-the-GPS-resource-from-ousaged.patch b/packages/tangogps/files/0003-Try-to-request-the-GPS-resource-from-ousaged.patch
new file mode 100644
index 0000000000..09b2c2ad8a
--- /dev/null
+++ b/packages/tangogps/files/0003-Try-to-request-the-GPS-resource-from-ousaged.patch
@@ -0,0 +1,73 @@
+From 2562a173716141cd9ea5c227dfa52f04ce4205f8 Mon Sep 17 00:00:00 2001
+From: Daniel Willmann <daniel@totalueberwachung.de>
+Date: Tue, 22 Jul 2008 00:22:58 +0200
+Subject: [PATCH] Try to request the GPS resource from ousaged
+
+---
+ configure.in | 2 +-
+ src/gps_functions.c | 22 ++++++++++++++++++++++
+ 2 files changed, 23 insertions(+), 1 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index cf06033..2bc3cf9 100644
+--- a/configure.in
++++ b/configure.in
+@@ -23,7 +23,7 @@ AM_GLIB_GNU_GETTEXT
+
+ AM_PROG_LIBTOOL
+
+-PKG_CHECK_MODULES(PACKAGE, [gtk+-2.0 gdk-2.0 gconf-2.0 gypsy])
++PKG_CHECK_MODULES(PACKAGE, [gtk+-2.0 gdk-2.0 gconf-2.0 dbus-glib-1 gypsy])
+ AC_SUBST(PACKAGE_CFLAGS)
+ AC_SUBST(PACKAGE_LIBS)
+
+diff --git a/src/gps_functions.c b/src/gps_functions.c
+index 57646e1..0802e67 100644
+--- a/src/gps_functions.c
++++ b/src/gps_functions.c
+@@ -11,6 +11,7 @@
+ #include <gypsy/gypsy-course.h>
+ #include <gypsy/gypsy-satellite.h>
+
++#include <dbus/dbus-glib.h>
+ #include <glib.h>
+ #include <glib/gprintf.h>
+
+@@ -705,6 +706,11 @@ static void on_satellites_changed(GypsySatellite *sat, GPtrArray *sats, void *u
+ #define GYPSY_OBJ_PATH "/org/freedesktop/Gypsy"
+
+ int setup_gypsy() {
++ DBusGConnection *connection;
++ DBusGProxy *proxy;
++ GError *error;
++ int result;
++
+ gpsdata = g_new0(gps_data_t,1);
+
+ GypsyControl *gyctrl = gypsy_control_get_default();
+@@ -723,6 +729,22 @@ int setup_gypsy() {
+ gpsdata->fix.mode = gypsy_device_get_fix_status(gydevice, NULL);
+ gpsdata->valid = gpsdata->fix.mode > 1;
+
++ error = NULL;
++ connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
++ if (connection == NULL) {
++ g_printerr ("Failed to open connection to bus: %s\n",
++ error->message);
++ g_error_free (error);
++ proxy = NULL;
++ }
++
++ proxy = dbus_g_proxy_new_for_name (connection,
++ "org.freesmartphone.ousaged",
++ "/org/freesmartphone/Usage",
++ "org.freesmartphone.Usage");
++
++ dbus_g_proxy_call (proxy, "RequestResource", &error, G_TYPE_STRING, "GPS", G_TYPE_INVALID, G_TYPE_BOOLEAN, &result, G_TYPE_INVALID);
++
+ return 1;
+ }
+
+--
+1.5.4.5
+
diff --git a/packages/tangogps/tangogps-fso_0.9.2.bb b/packages/tangogps/tangogps-fso_0.9.2.bb
new file mode 100644
index 0000000000..e05b72dc29
--- /dev/null
+++ b/packages/tangogps/tangogps-fso_0.9.2.bb
@@ -0,0 +1,13 @@
+LICENSE = "GPLv2"
+SECTION = "x11/applications"
+PRIORITY = "optional"
+DESCRIPTION = "lightweight and fast mapping application"
+DEPENDS = "curl gtk+ gconf gypsy dbus-glib"
+
+inherit autotools
+
+SRC_URI = "http://www.tangogps.org/downloads/tangogps-${PV}.tar.gz\
+ file://0002-Get-GPS-data-via-the-gypsy-interface.patch;patch=1 \
+ file://0003-Try-to-request-the-GPS-resource-from-ousaged.patch;patch=1"
+
+S=${WORKDIR}/tangogps-${PV}