From: Kaj-Michael Lang Date: Sun, 28 Oct 2007 10:11:08 +0000 (+0200) Subject: GPS Connection handlings code cleanups X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d52cd541c5275f36c2a62429e7b0732ae22a61ac;p=mapper GPS Connection handlings code cleanups --- diff --git a/src/bt-bluez.c b/src/bt-bluez.c index f1cd511..33db0fa 100644 --- a/src/bt-bluez.c +++ b/src/bt-bluez.c @@ -36,22 +36,22 @@ struct sockaddr_rc _rcvr_addr = { 0 }; +static gint fd; + static gboolean channel_cb_connect(GIOChannel * src, GIOCondition condition, gpointer data) { gint error, size = sizeof(error); -if (*_rcvr_mac != '/' && (getsockopt(_fd, SOL_SOCKET, SO_ERROR, &error, &size) || error)) { +if (*_rcvr_mac != '/' && (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &size) || error)) { g_printf("Error connecting to receiver; retrying...\n"); /* Try again. */ rcvr_disconnect(); rcvr_connect_later(); } else { g_printf("Connected to receiver!\n"); - set_conn_state(RCVR_UP); - _input_sid = g_io_add_watch_full(_channel, G_PRIORITY_LOW, - G_IO_IN | G_IO_PRI, - channel_cb_input, NULL, NULL); + gps_conn_set_state(RCVR_UP); + _input_sid = g_io_add_watch_full(_channel, G_PRIORITY_LOW, G_IO_IN | G_IO_PRI, channel_cb_input, NULL, NULL); } _connect_sid = 0; @@ -62,7 +62,7 @@ static gboolean rcvr_connect_bt(void) { int r, e; -r = connect(_fd, (struct sockaddr *)&_rcvr_addr, sizeof(_rcvr_addr)); +r = connect(fd, (struct sockaddr *)&_rcvr_addr, sizeof(_rcvr_addr)); e = errno; /* The socket is non blocking so handle it */ @@ -101,7 +101,7 @@ return TRUE; gint scan_start_search(ScanInfo * scan_info) { -scan_info->sid = g_idle_add((GSourceFunc) scan_bluetooth_idle, scan_info); +scan_info->sid = g_idle_add((GSourceFunc)scan_bluetooth_idle, scan_info); return 0; } @@ -138,15 +138,15 @@ if (_channel) { } /* Close the file descriptor. */ -if (_fd != -1) { - close(_fd); - _fd = -1; +if (fd != -1) { + close(fd); + fd = -1; } } /** * Connect to the receiver. - * This method assumes that _fd is -1 and _channel is NULL. If unsure, call + * This method assumes that fd is -1 and _channel is NULL. If unsure, call * rcvr_disconnect() first. * Since this is an idle function, this function returns whether or not it * should be called again, which is always FALSE. @@ -171,15 +171,15 @@ if (_conn_state == RCVR_DOWN && _rcvr_mac) { #ifndef DEBUG_GPS /* Create the file descriptor. */ if (*_rcvr_mac == '/') - _fd = open(_rcvr_mac, O_RDONLY); + fd = open(_rcvr_mac, O_RDONLY); else - _fd = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); + fd = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); /* If file descriptor creation failed, try again later. Note that * there is no need to call rcvr_disconnect() because the file * descriptor creation is the first step, so if it fails, there's * nothing to clean up. */ - if (_fd == -1) { + if (fd == -1) { g_printf("Failed to create socket\n"); rcvr_connect_later(); } else { @@ -189,7 +189,7 @@ if (_conn_state == RCVR_DOWN && _rcvr_mac) { _gps_read_buf_last = _gps_read_buf + GPS_READ_BUF_SIZE - 1; /* Create channel and add watches. */ - _channel = g_io_channel_unix_new(_fd); + _channel = g_io_channel_unix_new(fd); g_io_channel_set_encoding(_channel, NULL, NULL); g_io_channel_set_flags(_channel, G_IO_FLAG_NONBLOCK, NULL); _error_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE, @@ -204,7 +204,7 @@ if (_conn_state == RCVR_DOWN && _rcvr_mac) { } #else /* We're in DEBUG mode, so instead of connecting, skip to FIXED. */ - set_conn_state(RCVR_FIXED); + gps_conn_set_state(RCVR_FIXED); #endif } @@ -230,7 +230,7 @@ inquiry_info *ii = NULL; devid = hci_get_route(NULL); -ii = (inquiry_info *) malloc(255 * sizeof(inquiry_info)); +ii = (inquiry_info *)malloc(255 * sizeof(inquiry_info)); num_rsp = hci_inquiry(devid, 4, 255, NULL, &ii, IREQ_CACHE_FLUSH); if (num_rsp < 0) { @@ -250,8 +250,7 @@ if (num_rsp < 0) { ba2str(&ii[i].bdaddr, addr); memset(name, 0, sizeof(name)); - if (hci_read_remote_name - (sock, &ii[i].bdaddr, sizeof(name), name, 0)) + if (hci_read_remote_name(sock, &ii[i].bdaddr, sizeof(name), name, 0)) strcpy(name, _("Unknown")); gtk_list_store_append(scan_info->store, &iter); diff --git a/src/bt-maemo.c b/src/bt-maemo.c index 59bf49b..ce76efd 100644 --- a/src/bt-maemo.c +++ b/src/bt-maemo.c @@ -15,6 +15,11 @@ #include "settings.h" #include "ui-common.h" +static guint errors; +static gint fd; + +void rcvr_connect_later(); /* Forward declaration. */ + /*****************************************************************************/ static gboolean @@ -22,9 +27,10 @@ channel_cb_connect(GIOChannel * src, GIOCondition condition, gpointer data) { _gps_read_buf_curr = _gps_read_buf; _gps_read_buf_last = _gps_read_buf + GPS_READ_BUF_SIZE - 1; -set_conn_state(RCVR_UP); +gps_conn_set_state(RCVR_UP); _input_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE, G_IO_IN | G_IO_PRI, channel_cb_input, NULL, NULL); _connect_sid = 0; +errors=0; return FALSE; } @@ -63,31 +69,29 @@ if (_channel) { } /* Close the file descriptor. */ -if (_fd != -1) { - close(_fd); - _fd = -1; +if (fd != -1) { + close(fd); + fd = -1; } if (_rfcomm_req_proxy) { dbus_g_proxy_call(_rfcomm_req_proxy, - BTCOND_RFCOMM_CANCEL_CONNECT_REQ, &error, - G_TYPE_STRING, _rcvr_mac, G_TYPE_STRING, - "SPP", G_TYPE_INVALID, G_TYPE_INVALID); + BTCOND_RFCOMM_CANCEL_CONNECT_REQ, &error, + G_TYPE_STRING, _rcvr_mac, G_TYPE_STRING, + "SPP", G_TYPE_INVALID, G_TYPE_INVALID); error = NULL; dbus_g_proxy_call(_rfcomm_req_proxy, - BTCOND_RFCOMM_DISCONNECT_REQ, &error, - G_TYPE_STRING, _rcvr_mac, G_TYPE_STRING, - "SPP", G_TYPE_INVALID, G_TYPE_INVALID); + BTCOND_RFCOMM_DISCONNECT_REQ, &error, + G_TYPE_STRING, _rcvr_mac, G_TYPE_STRING, + "SPP", G_TYPE_INVALID, G_TYPE_INVALID); } } -void rcvr_connect_later(); /* Forward declaration. */ - void -rcvr_connect_fd(gchar * fdpath) +rcvr_connect_fd(gchar *fdpath) { /* If file descriptor creation failed, try again later. */ -if (-1 == (_fd = open(fdpath, O_RDONLY))) { +if (-1 == (fd = open(fdpath, O_RDONLY))) { rcvr_disconnect(); rcvr_connect_later(); } else { @@ -96,24 +100,22 @@ if (-1 == (_fd = open(fdpath, O_RDONLY))) { *_gps_read_buf_curr = '\0'; /* Create channel and add watches. */ - _channel = g_io_channel_unix_new(_fd); + _channel = g_io_channel_unix_new(fd); g_io_channel_set_flags(_channel, G_IO_FLAG_NONBLOCK, NULL); - _error_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE, - G_IO_ERR | G_IO_HUP, channel_cb_error, NULL, NULL); - _connect_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE, - G_IO_OUT, channel_cb_connect, NULL, NULL); - } + _error_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE, G_IO_ERR | G_IO_HUP, channel_cb_error, NULL, NULL); + _connect_sid = g_io_add_watch_full(_channel, G_PRIORITY_HIGH_IDLE, G_IO_OUT, channel_cb_connect, NULL, NULL); +} g_free(fdpath); } -void rcvr_connect_response(DBusGProxy * proxy, DBusGProxyCall * call_id) +void +rcvr_connect_response(DBusGProxy * proxy, DBusGProxyCall * call_id) { GError *error = NULL; gchar *fdpath = NULL; if (_conn_state == RCVR_DOWN && _rcvr_mac) { - if (!dbus_g_proxy_end_call(_rfcomm_req_proxy, call_id, &error, - G_TYPE_STRING, &fdpath, G_TYPE_INVALID)) { + if (!dbus_g_proxy_end_call(_rfcomm_req_proxy, call_id, &error, G_TYPE_STRING, &fdpath, G_TYPE_INVALID)) { if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) { /* If we're already connected, it's not an error, unless * they don't give us the file descriptor path, in which @@ -124,13 +126,12 @@ if (_conn_state == RCVR_DOWN && _rcvr_mac) { rcvr_disconnect(); /* Ask user to re-connect. */ - confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), - _("Failed to connect to GPS receiver. Retry?")); + confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), _("Failed to connect to GPS receiver. Retry?")); if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) rcvr_connect_later(); /* Try again later. */ else - set_conn_state(RCVR_OFF); + gps_conn_set_state(RCVR_OFF); gtk_widget_destroy(confirm); return; @@ -150,15 +151,16 @@ if (_conn_state == RCVR_DOWN && _rcvr_mac) { /** * Connect to the receiver. - * This method assumes that _fd is -1 and _channel is NULL. If unsure, call + * This method assumes that fd is -1 and _channel is NULL. If unsure, call * rcvr_disconnect() first. * Since this is an idle function, this function returns whether or not it * should be called again, which is always FALSE. */ -gboolean rcvr_connect_now() +gboolean +rcvr_connect_now() { if (_conn_state == RCVR_DOWN && _rcvr_mac) { -#ifndef DEBUG +#ifndef DEBUG_GPS if (*_rcvr_mac != '/') { if (_rfcomm_req_proxy) { gint mybool = TRUE; @@ -173,13 +175,13 @@ if (_conn_state == RCVR_DOWN && _rcvr_mac) { G_TYPE_BOOLEAN, &mybool, G_TYPE_INVALID); } - } else + } else { rcvr_connect_fd(g_strdup(_rcvr_mac)); - + } #else /* We're in DEBUG mode, so instead of connecting, skip to FIXED. */ printf("FIXED!\n"); - set_conn_state(RCVR_FIXED); + gps_conn_set_state(RCVR_FIXED); #endif } @@ -193,13 +195,14 @@ return FALSE; void rcvr_connect_later() { -_clater_sid = g_timeout_add(1000, (GSourceFunc) rcvr_connect_now, NULL); +_clater_sid = g_timeout_add(1000, (GSourceFunc)rcvr_connect_now, NULL); } +/** + * Bluetooth device scanning functions below + */ static void -scan_cb_dev_found(DBusGProxy * sig_proxy, const gchar * bda, - const gchar * name, gpointer * class, guchar rssi, gint coff, - ScanInfo * scan_info) +scan_cb_dev_found(DBusGProxy *sig_proxy, const gchar *bda, const gchar *name, gpointer *class, guchar rssi, gint coff, ScanInfo *scan_info) { GtkTreeIter iter; gtk_list_store_append(scan_info->store, &iter); @@ -210,75 +213,43 @@ static void scan_cb_search_complete(DBusGProxy * sig_proxy, ScanInfo * scan_info) { gtk_widget_destroy(scan_info->banner); -dbus_g_proxy_disconnect_signal(sig_proxy, BTSEARCH_DEV_FOUND_SIG, - G_CALLBACK(scan_cb_dev_found), scan_info); -dbus_g_proxy_disconnect_signal(sig_proxy, BTSEARCH_SEARCH_COMPLETE_SIG, - G_CALLBACK(scan_cb_search_complete), scan_info); +dbus_g_proxy_disconnect_signal(sig_proxy, BTSEARCH_DEV_FOUND_SIG, G_CALLBACK(scan_cb_dev_found), scan_info); +dbus_g_proxy_disconnect_signal(sig_proxy, BTSEARCH_SEARCH_COMPLETE_SIG, G_CALLBACK(scan_cb_search_complete), scan_info); } gint scan_start_search(ScanInfo * scan_info) { GError *error = NULL; -DBusGConnection *dbus_conn; - /* Initialize D-Bus. */ - if (NULL == (dbus_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error))) { - g_printerr("Failed to open connection to D-Bus: %s.\n", - error->message); - return 1; - } +if (NULL == (scan_info->req_proxy = dbus_g_proxy_new_for_name(dbus_conn, BTSEARCH_SERVICE, BTSEARCH_REQ_PATH, BTSEARCH_REQ_INTERFACE))) { + g_printerr("Failed to create D-Bus request proxy for btsearch."); + return 2; +} - if (NULL == (scan_info->req_proxy = dbus_g_proxy_new_for_name(dbus_conn, - BTSEARCH_SERVICE, - BTSEARCH_REQ_PATH, - BTSEARCH_REQ_INTERFACE))) - { - g_printerr - ("Failed to create D-Bus request proxy for btsearch."); - return 2; - } +if (NULL == (scan_info->sig_proxy = dbus_g_proxy_new_for_name(dbus_conn, BTSEARCH_SERVICE, BTSEARCH_SIG_PATH, BTSEARCH_SIG_INTERFACE))) { + g_printerr("Failed to create D-Bus signal proxy for btsearch."); + return 2; +} - if (NULL == (scan_info->sig_proxy = dbus_g_proxy_new_for_name(dbus_conn, - BTSEARCH_SERVICE, - BTSEARCH_SIG_PATH, - BTSEARCH_SIG_INTERFACE))) - { - g_printerr("Failed to create D-Bus signal proxy for btsearch."); - return 2; - } +dbus_g_object_register_marshaller(_bt_maemo_VOID__STRING_STRING_POINTER_UCHAR_UINT, + G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, DBUS_TYPE_G_UCHAR_ARRAY, G_TYPE_UCHAR, G_TYPE_UINT, G_TYPE_INVALID); - dbus_g_object_register_marshaller(_bt_maemo_VOID__STRING_STRING_POINTER_UCHAR_UINT, - G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, DBUS_TYPE_G_UCHAR_ARRAY, - G_TYPE_UCHAR, G_TYPE_UINT, G_TYPE_INVALID); - - dbus_g_proxy_add_signal(scan_info->sig_proxy, - BTSEARCH_DEV_FOUND_SIG, - G_TYPE_STRING, - G_TYPE_STRING, - DBUS_TYPE_G_UCHAR_ARRAY, - G_TYPE_UCHAR, G_TYPE_UINT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(scan_info->sig_proxy, BTSEARCH_DEV_FOUND_SIG, - G_CALLBACK(scan_cb_dev_found), scan_info, - NULL); - - dbus_g_proxy_add_signal(scan_info->sig_proxy, - BTSEARCH_SEARCH_COMPLETE_SIG, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(scan_info->sig_proxy, BTSEARCH_SEARCH_COMPLETE_SIG, - G_CALLBACK(scan_cb_search_complete), - scan_info, NULL); +dbus_g_proxy_add_signal(scan_info->sig_proxy, BTSEARCH_DEV_FOUND_SIG, G_TYPE_STRING, G_TYPE_STRING, DBUS_TYPE_G_UCHAR_ARRAY, G_TYPE_UCHAR, G_TYPE_UINT, G_TYPE_INVALID); +dbus_g_proxy_connect_signal(scan_info->sig_proxy, BTSEARCH_DEV_FOUND_SIG, G_CALLBACK(scan_cb_dev_found), scan_info, NULL); - error = NULL; - if (!dbus_g_proxy_call(scan_info->req_proxy, BTSEARCH_START_SEARCH_REQ, - &error, G_TYPE_INVALID, G_TYPE_INVALID)) { - if (error->domain == DBUS_GERROR - && error->code == DBUS_GERROR_REMOTE_EXCEPTION) { - g_printerr("Caught remote method exception %s: %s", - dbus_g_error_get_name(error), error->message); - } else - g_printerr("Error: %s\n", error->message); - return 3; +dbus_g_proxy_add_signal(scan_info->sig_proxy, BTSEARCH_SEARCH_COMPLETE_SIG, G_TYPE_INVALID); +dbus_g_proxy_connect_signal(scan_info->sig_proxy, BTSEARCH_SEARCH_COMPLETE_SIG, G_CALLBACK(scan_cb_search_complete), scan_info, NULL); + +error = NULL; +if (!dbus_g_proxy_call(scan_info->req_proxy, BTSEARCH_START_SEARCH_REQ, &error, G_TYPE_INVALID, G_TYPE_INVALID)) { + if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) { + g_printerr("Caught remote method exception %s: %s", dbus_g_error_get_name(error), error->message); + } else { + g_printerr("Error: %s\n", error->message); } + return 3; +} return 0; } diff --git a/src/cb.c b/src/cb.c index b7ba0c4..b92a605 100644 --- a/src/cb.c +++ b/src/cb.c @@ -33,7 +33,7 @@ #include "latlon.h" #include "cb.h" #include "gps-panels.h" - +#include "gps-conn.h" #include "help.h" gboolean @@ -479,7 +479,7 @@ menu_cb_enable_gps(GtkAction * action) { if ((_enable_gps = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))) { if (_rcvr_mac) { - set_conn_state(RCVR_DOWN); + gps_conn_set_state(RCVR_DOWN); rcvr_connect_now(); } else { popup_error(_window, _("Cannot enable GPS until a GPS Receiver MAC is set in the Settings dialog box.")); @@ -487,7 +487,7 @@ if ((_enable_gps = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))) { } } else { if (_conn_state > RCVR_OFF) - set_conn_state(RCVR_OFF); + gps_conn_set_state(RCVR_OFF); rcvr_disconnect(); track_add(0, FALSE); _speed_excess=FALSE; @@ -528,7 +528,7 @@ menu_cb_settings(GtkAction * action) if (settings_dialog()) { /* Settings have changed - reconnect to receiver. */ if (_enable_gps) { - set_conn_state(RCVR_DOWN); + gps_conn_set_state(RCVR_DOWN); rcvr_disconnect(); rcvr_connect_now(); } diff --git a/src/gps-conn.c b/src/gps-conn.c index 1c177e0..34865ae 100644 --- a/src/gps-conn.c +++ b/src/gps-conn.c @@ -25,48 +25,48 @@ static GtkWidget *fix_banner = NULL; #include "map.h" #include "bt.h" #include "ui-common.h" +#include "gps-conn.h" /** - * Set the connection state. This function controls all connection-related - * banners. + * Set the connection state. This function controls all connection-related banners. */ void -set_conn_state(ConnState new_conn_state) +gps_conn_set_state(ConnState new_conn_state) { switch (_conn_state = new_conn_state) { case RCVR_OFF: case RCVR_FIXED: if (connect_banner) { gtk_widget_destroy(connect_banner); - connect_banner = NULL; + connect_banner=NULL; } if (fix_banner) { gtk_widget_destroy(fix_banner); - fix_banner = NULL; + fix_banner=NULL; } break; case RCVR_DOWN: if (fix_banner) { gtk_widget_destroy(fix_banner); - fix_banner = NULL; + fix_banner=NULL; } if (!connect_banner) - connect_banner = hildon_banner_show_animation(_window, NULL, _("Searching for GPS receiver")); + connect_banner=hildon_banner_show_animation(_window, NULL, _("Searching for GPS receiver")); break; case RCVR_UP: if (connect_banner) { gtk_widget_destroy(connect_banner); - connect_banner = NULL; + connect_banner=NULL; } if (!fix_banner) - fix_banner = hildon_banner_show_progress(_window, NULL, _("Establishing GPS fix")); + fix_banner=hildon_banner_show_progress(_window, NULL, _("Establishing GPS fix")); break; default:; /* to quell warning. */ } } void -set_fix_progress(gdouble fix) +gps_conn_set_progress(gdouble fix) { #ifdef WITH_HILDON hildon_banner_set_fraction(fix_banner, fix); diff --git a/src/gps-nmea-parse.c b/src/gps-nmea-parse.c index 6e2300b..3bf75a6 100644 --- a/src/gps-nmea-parse.c +++ b/src/gps-nmea-parse.c @@ -25,31 +25,29 @@ #include "route.h" #include "gps-panels.h" #include "settings.h" - +#include "gps-conn.h" #include "gtkgps.h" #include "gtkcompass.h" + #define GPS_FILTER_MAX_SKIP (10) static gint track_drop_cnt=0; gboolean channel_cb_error(GIOChannel * src, GIOCondition condition, gpointer data) { - printf("%s(%d)\n", __PRETTY_FUNCTION__, condition); - - /* An error has occurred - re-connect(). */ - rcvr_disconnect(); - track_add(0, FALSE); - _speed_excess = FALSE; - - if (_conn_state > RCVR_OFF) { - set_conn_state(RCVR_DOWN); - gps_hide_text(); - rcvr_connect_later(); - } +/* An error has occurred - re-connect(). */ +rcvr_disconnect(); +track_add(0, FALSE); +_speed_excess = FALSE; + +if (_conn_state > RCVR_OFF) { + gps_conn_set_state(RCVR_DOWN); + gps_hide_text(); + rcvr_connect_later(); +} - vprintf("%s(): return\n", __PRETTY_FUNCTION__); - return FALSE; +return FALSE; } static void @@ -89,12 +87,12 @@ channel_parse_rmc(gchar * sentence) /* Data is valid. */ if (_conn_state != RCVR_FIXED) { newly_fixed = TRUE; - set_conn_state(RCVR_FIXED); + gps_conn_set_state(RCVR_FIXED); } } else { /* Data is invalid - not enough satellites?. */ if (_conn_state != RCVR_UP) { - set_conn_state(RCVR_UP); + gps_conn_set_state(RCVR_UP); track_add(0, FALSE); } } @@ -402,7 +400,7 @@ channel_parse_gsv(gchar * sentence) if (_conn_state == RCVR_UP) { gdouble fraction = running_total * sqrt(num_sats_used) / num_sats_used / 100.0; BOUND(fraction, 0.0, 1.0); - set_fix_progress(fraction); + gps_conn_set_progress(fraction); } running_total = 0; num_sats_used = 0; diff --git a/src/gps.h b/src/gps.h index 607f740..fae11db 100644 --- a/src/gps.h +++ b/src/gps.h @@ -24,11 +24,10 @@ #define GPS_READ_BUF_SIZE 1024 -/** The file descriptor of our connection with the GPS receiver. */ -gint _fd; gchar _gps_read_buf[GPS_READ_BUF_SIZE]; gchar *_gps_read_buf_curr; gchar *_gps_read_buf_last; + DBusGProxy *_rfcomm_req_proxy; /** The GIOChannel through which communication with the GPS receiver is diff --git a/src/maemo-osso.c b/src/maemo-osso.c index 68058ee..7e2b57e 100644 --- a/src/maemo-osso.c +++ b/src/maemo-osso.c @@ -50,7 +50,7 @@ if (state->system_inactivity_ind) { if (_conn_state > RCVR_OFF) { if (gconf_client_get_bool(gconf_client, GCONF_KEY_DISCONNECT_ON_COVER, NULL)) { gconf_client_clear_cache(gconf_client); - set_conn_state(RCVR_OFF); + gps_conn_set_state(RCVR_OFF); rcvr_disconnect(); track_add(0, FALSE); /* Pretend autoroute is in progress to avoid download. */ @@ -70,7 +70,7 @@ if (state->system_inactivity_ind) { /* Drop any memory we can.. */ } else { if (_conn_state == RCVR_OFF && _enable_gps) { - set_conn_state(RCVR_DOWN); + gps_conn_set_state(RCVR_DOWN); rcvr_connect_later(); if (_autoroute_data.enabled) _autoroute_data.in_progress = TRUE; diff --git a/src/ui-common.c b/src/ui-common.c index fa7fcd4..98a2a92 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -423,8 +423,8 @@ if (done_here) { /* Re-enable any banners that might have been up. */ { ConnState old_state = _conn_state; - set_conn_state(RCVR_OFF); - set_conn_state(old_state); + gps_conn_set_state(RCVR_OFF); + gps_conn_set_state(old_state); } }