From: Kaj-Michael Lang Date: Wed, 23 Jan 2008 23:16:16 +0000 (+0200) Subject: Add gpsbt support. Untested. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d53ade58db4dacefec37ddf9e05263b1c6e1835b;p=mapper Add gpsbt support. Untested. --- diff --git a/src/gps.c b/src/gps.c index 892b3a6..b2e2635 100644 --- a/src/gps.c +++ b/src/gps.c @@ -45,8 +45,10 @@ #include "gps-conn.h" #include "track.h" -#define GPSD_NMEA "r+\r\n" -#define GPSD_PORT (2947) +#ifdef WITH_GPSBT +#include +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