AC_ARG_ENABLE(avoid-float, [ --enable-avoid-float avoid floating point calculations], AVOID_FLOAT=$enableval, AVOID_FLOAT=no)
test x"${AVOID_FLOAT}" = xyes && AC_DEFINE(AVOID_FLOAT,[],Define to avoid floating point)
-AC_ARG_ENABLE(hildon, [ --enable-hildon build with maemo/hildon support], enable_hildon=$enableval, enable_hildon=no)
+AC_ARG_ENABLE(hildon, [ --disable-hildon build without maemo/hildon support], enable_hildon=$enableval, enable_hildon=yes)
if test "x${enable_hildon}" = "xyes" ; then
PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.9, , [
AC_MSG_RESULT(no)
enable_hildon=no
])
+ PKG_CHECK_MODULES(GPSBT, gpsbt, [
+ AC_DEFINE(HAVE_GPSBT, 1, [Have the gpsbt library])
+ AC_SUBST(GPSBT_CFLAGS)
+ AC_SUBST(GPSBT_LIBS)
+ ], [
+ AC_MSG_RESULT(no)
+ ])
if test x"${enable_hildon}" = xyes ; then
AC_DEFINE(USE_HILDON, 1, [Build with maemo/hildon support])
AC_SUBST(HILDON_CFLAGS)
navit_destroy(struct navit *this_)
{
/* TODO: destroy objects contained in this_ */
+ vehicle_destroy(this_->vehicle->vehicle);
main_remove_navit(this_);
char *center_file = navit_get_center_file(TRUE);
navit_write_center_to_file(this_, center_file);
void
vehicle_destroy(struct vehicle *this_)
{
+ this_->meth.destroy(this_->priv);
callback_list_destroy(this_->cbl);
attr_list_free(this_->attrs);
g_free(this_);
include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=vehicle_gpsd
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @GPSBT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=vehicle_gpsd
modulevehicle_LTLIBRARIES = libvehicle_gpsd.la
libvehicle_gpsd_la_SOURCES = vehicle_gpsd.c
-libvehicle_gpsd_la_LIBADD = @GPSD_LIBS@
+libvehicle_gpsd_la_LIBADD = @GPSD_LIBS@ @GPSBT_LIBS@
#include <string.h>
#include <glib.h>
#include <math.h>
+#ifdef HAVE_GPSBT
+#include <gpsbt.h>
+#include <errno.h>
+#endif
#include "debug.h"
#include "callback.h"
#include "plugin.h"
static void
vehicle_gpsd_open(struct vehicle_priv *priv)
{
+#ifdef HAVE_GPSBT
+ char errstr[256] = "";
+ /* We need to start gpsd (via gpsbt) first. */
+ errno = 0;
+ memset(&priv->context, 0, sizeof(gpsbt_t));
+ if(gpsbt_start(NULL, 1, 0, 0, errstr, sizeof(errstr),
+ 0, &priv->context) < 0) {
+ dbg(0,"Error connecting to GPS with gpsbt: (%d) %s (%s)\n",
+ errno, strerror(errno), errstr);
+ }
+ sleep(1); /* give gpsd time to start */
+ dbg(1,"gpsbt_start: completed\n");
+#endif
priv->retry_timer=0;
if (vehicle_gpsd_try_open((gpointer *)priv)) {
priv->retry_timer = g_timeout_add(priv->retry_interval*1000, (GSourceFunc)vehicle_gpsd_try_open, (gpointer *)priv);
vehicle_gpsd_close(struct vehicle_priv *priv)
{
GError *error = NULL;
+#ifdef HAVE_GPSBT
+ int err;
+#endif
if (priv->watch) {
g_source_remove(priv->watch);
gps_close(priv->gps);
priv->gps = NULL;
}
+#ifdef HAVE_GPSBT
+ err = gpsbt_stop(&priv->context);
+ if (err < 0) {
+ dbg(0,"Error %d while gpsbt_stop", err);
+ }
+ dbg(1,"gpsbt_stop: completed, (%d)",err);
+#endif
}
static gboolean