From 1f3bda74c18d18b4cd5667f5d9b186724642ad69 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 4 Feb 2008 09:44:52 +0200 Subject: [PATCH] Add field with default gps address/ip --- src/gps.c | 14 ++++++++------ src/gps.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gps.c b/src/gps.c index 0523be5..629d529 100644 --- a/src/gps.c +++ b/src/gps.c @@ -66,6 +66,8 @@ static gboolean gps_connect_file(Gps *gps, gchar *file); #define GPSD_NMEA "r+\r\n" #define GPSD_PORT (2947) +#define LOCALHOST "127.0.0.1" +#define GPS_DEVICE_FILE "/dev/ttyS0" const GpsTypes gps_types[] = { #ifdef WITH_BLUEZ @@ -77,11 +79,11 @@ const GpsTypes gps_types[] = { #ifdef WITH_BLUEZ_DBUS_BT { GPS_IO_BLUEZ_DBUS, "Bluetooth connection (new)", TRUE, TRUE, FALSE}, #endif - { GPS_IO_GPSD, "GPSD Connection", FALSE, TRUE, TRUE, GPSD_PORT }, - { GPS_IO_FILE, "File or device", FALSE, TRUE, FALSE}, - { GPS_IO_TCP, "TCP Connection", FALSE, TRUE, TRUE, 1024 }, + { GPS_IO_GPSD, "GPSD Connection", FALSE, TRUE, TRUE, GPSD_PORT, LOCALHOST }, + { GPS_IO_FILE, "File or device", FALSE, TRUE, FALSE, 0, GPS_DEVICE_FILE }, + { GPS_IO_TCP, "TCP Connection", FALSE, TRUE, TRUE, 1024, LOCALHOST }, #ifdef WITH_GYPSY - { GPS_IO_GYPSY, "Gypsy", FALSE, TRUE, FALSE}, + { GPS_IO_GYPSY, "Gypsy", FALSE, TRUE, FALSE }, #endif { GPS_IO_SIMULATION, "Simulation (random)", FALSE, FALSE, FALSE}, { 0 } @@ -614,9 +616,9 @@ switch (gps->io.type) { g_debug("GPS: Requesting NMEA mode from GPSD using cmd %s", GPSD_NMEA); status=g_io_channel_write_chars(gps->io.channel, GPSD_NMEA, strlen(GPSD_NMEA), &written, &error); if (status==G_IO_STATUS_NORMAL && written==strlen(GPSD_NMEA)) { - g_debug("GPS: NMEA mode set (%d %d)", written, status); + g_debug("GPS: NMEA mode set (%d %d)", (gint)written, (gint)status); } else { - g_printerr("Failed to set gpsd to NMEA mode: %d %d %s\n",status, written, error->message); + g_printerr("Failed to set gpsd to NMEA mode: %d %d %s\n",(gint)status,(gint)written, error->message); g_error_free(error); gps_disconnect(gps); gps_connect_later(gps); diff --git a/src/gps.h b/src/gps.h index 498d3e6..c60f895 100644 --- a/src/gps.h +++ b/src/gps.h @@ -59,7 +59,7 @@ struct _GpsTypes { gboolean address; /* Needs address */ gboolean port; /* Needs port */ guint port_def; /* Default port */ - + const gchar *address_def; /* Default mac/ip/device */ }; /** This enumerated type defines the possible connection states. */ -- 2.39.5