]> err.no Git - mapper/commitdiff
Add gpsbt support. Untested.
authorKaj-Michael Lang <milang@tal.org>
Wed, 23 Jan 2008 23:16:16 +0000 (01:16 +0200)
committerKaj-Michael Lang <milang@tal.org>
Wed, 23 Jan 2008 23:16:16 +0000 (01:16 +0200)
src/gps.c

index 892b3a64f757229dfa85dd2db29ccb96e6557801..b2e26352dcae31db75f2feed76f82a818d542dad 100644 (file)
--- a/src/gps.c
+++ b/src/gps.c
 #include "gps-conn.h"
 #include "track.h"
 
-#define GPSD_NMEA "r+\r\n"
-#define GPSD_PORT (2947)
+#ifdef WITH_GPSBT
+#include <gpsbt.h>
+static gpsbt_t ctx = {0};
+#endif
 
 static gboolean gps_channel_cb_error(GIOChannel *src, GIOCondition condition, gpointer data);
 static gboolean gps_channel_cb_input(GIOChannel *src, GIOCondition condition, gpointer data);
@@ -54,6 +56,9 @@ static gboolean gps_channel_cb_connect(GIOChannel * src, GIOCondition condition,
 static gboolean gps_connect_socket(Gps *gps);
 static gboolean gps_connect_file(Gps *gps);
 
+#define GPSD_NMEA "r+\r\n"
+#define GPSD_PORT (2947)
+
 /**
  * Init GPS structure
  */
@@ -253,6 +258,15 @@ if (gps->io.fd!=-1) {
        gps->io.fd=-1;
 }
 
+#ifdef WITH_GPSBT
+if (gps->io.type==GPS_IO_GPSD) {
+       gint r;
+       r=gpsbt_stop(&ctx);
+       if (r!=0)
+               g_warning("Failed to stop gpsd\n");
+}
+#endif
+
 #ifdef WITH_HILDON_DBUS_BT
 if (gps->io.type==GPS_IO_HILDON_DBUS && gps->io.rfcomm_req_proxy) {
                GError *error = NULL;
@@ -311,6 +325,17 @@ switch (gps->io.type) {
                } else {
                        return FALSE;
                }
+#ifdef WITH_GPSBT
+               if (gps->io.type==GPS_IO_GPSD) {
+                       gint r;
+                       gchar ebuf[128];
+                       r=gpsbt_start(NULL, 0, 0, 0, ebuf, 128, 0, &ctx);
+                       if (r!=0) {
+                               g_warning("Failed to start gpsd");
+                               return FALSE;
+                       }
+               }
+#endif
        break;
        case GPS_IO_HILDON_DBUS:
 #ifdef WITH_HILDON_DBUS_BT