# HG changeset patch # User Paula Stanciu # Date 1218100269 -10800 # Node ID dc22e3d2e56e247bf4d62c941b96254a37aea456 # Parent dd8b44fbfd6fa1a21f77373e7dcc8a973de151e1 fixed bonding an allready bonded device bug diff -r dd8b44fbfd6f -r dc22e3d2e56e src/bluetooth/Makefile --- a/src/bluetooth/Makefile Mon Aug 04 06:49:41 2008 +0300 +++ b/src/bluetooth/Makefile Thu Aug 07 12:11:09 2008 +0300 @@ -1,9 +1,8 @@ PLUGIN = bluetooth${PLUGIN_SUFFIX} -SRCS = bluetooth.c gui.c marshal.c scan_gui.c agent.c +SRCS = bluetooth.c gui.c marshal.c scan_gui.c agent.c include ../../buildsys.mk include ../../extra.mk - plugindir := ${plugindir}/${GENERAL_PLUGIN_DIR} CFLAGS += ${PLUGIN_CFLAGS} CPPFLAGS += ${PLUGIN_CPPFLAGS} ${BEEP_DEFINES} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${DBUS_GLIB_CFLAGS} ${PANGO_CFLAGS} -I../../intl -I../.. ${BLUEZ_CFLAGS} diff -r dd8b44fbfd6f -r dc22e3d2e56e src/bluetooth/agent.c --- a/src/bluetooth/agent.c Mon Aug 04 06:49:41 2008 +0300 +++ b/src/bluetooth/agent.c Thu Aug 07 12:11:09 2008 +0300 @@ -199,6 +199,7 @@ GError *error; error = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT, "Pairing request rejected"); + printf("passkey error\n"); dbus_g_method_return_error(input->context, error); } @@ -339,10 +340,11 @@ /* translators: Whether to grant access to a particular service * to the device mentioned */ - // g_signal_connect(G_OBJECT(dialog), "response", - // G_CALLBACK(auth_callback), input); + /* g_signal_connect(G_OBJECT(dialog), "response", + G_CALLBACK(auth_callback), input); - //enable_blinking(); + enable_blinking(); + */ } typedef struct { @@ -392,9 +394,6 @@ g_printf("new passkey agent \n"); return agent; } - - - static gboolean passkey_agent_request(PasskeyAgent *agent, const char *path, const char *address, DBusGMethodInvocation *context) @@ -816,6 +815,7 @@ text = g_strdup_printf(_("Removed bonding with %s"), device); g_free(device); + printf("bonding removed"); // show_notification(adapter ? adapter : _("Bluetooth device"), // text, NULL, 6000, NULL); diff -r dd8b44fbfd6f -r dc22e3d2e56e src/bluetooth/bluetooth.c --- a/src/bluetooth/bluetooth.c Mon Aug 04 06:49:41 2008 +0300 +++ b/src/bluetooth/bluetooth.c Thu Aug 07 12:11:09 2008 +0300 @@ -24,6 +24,7 @@ #include "gui.h" #include "scan_gui.h" #include "agent.h" +#include #define DEBUG 1 static gboolean plugin_active = FALSE,exiting=FALSE; GList * current_device = NULL; @@ -44,7 +45,7 @@ void discover_devices(void); void disconnect_dbus_signals(void); static void show_restart_dialog(void); - +static void remove_bonding(); GeneralPlugin bluetooth_gp = { .description = "Bluetooth audio support", @@ -72,6 +73,7 @@ close_window(); config =0; } + remove_bonding(); if(discover_finish == 2) { dbus_g_connection_flush (bus); dbus_g_connection_unref(bus); @@ -118,7 +120,12 @@ audio_devices = NULL; //g_list_free(current_device); } +static void remove_bonding() +{ + dbus_g_object_register_marshaller(marshal_VOID__STRING_UINT_INT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_call(obj,"RemoveBonding",NULL,G_TYPE_STRING,"00:0D:3C:B1:1C:7A",G_TYPE_INVALID,G_TYPE_INVALID); +} void refresh_call(void) { printf("refresh function called\n"); @@ -172,8 +179,6 @@ temp_file_name = g_strconcat(home,"/temp_bt",NULL); file = fopen(file_name,"r"); temp_file = fopen(temp_file_name,"w"); - /* hardcoded address TO REMOVE after testing */ - // current_address = "00:0D:3C:B1:1C:7A"; device_line = g_strdup_printf("device %s\n",current_address); if ( file != NULL ) { @@ -219,15 +224,15 @@ } static void show_restart_dialog() { -static GtkWidget *window = NULL; - GtkWidget *dialog; - dialog = gtk_message_dialog_new (GTK_WINDOW (window), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - "Please restart the player to apply the bluetooth audio settings!"); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); + static GtkWidget *window = NULL; + GtkWidget *dialog; + dialog = gtk_message_dialog_new (GTK_WINDOW (window), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Please restart the player to apply the bluetooth audio settings!"); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); } static void remote_device_found(DBusGProxy *object, char *address, const unsigned int class, const int rssi, gpointer user_data) diff -r dd8b44fbfd6f -r dc22e3d2e56e src/bluetooth/bluetooth.h --- a/src/bluetooth/bluetooth.h Mon Aug 04 06:49:41 2008 +0300 +++ b/src/bluetooth/bluetooth.h Thu Aug 07 12:11:09 2008 +0300 @@ -28,7 +28,9 @@ #include #include #include - +#include +#include +#include #include "gui.h" typedef struct { guint class;