public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: BlueZ Hackers <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] [PATCH] Make BluetoothClient work on all adapters
Date: Tue, 24 Jul 2007 17:16:33 +0100	[thread overview]
Message-ID: <1185293793.3641.129.camel@cookie.hadess.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

With this patch, we can now pass a NULL as the adapter to work with all
the adapters. This is for use in the upcoming patch for the selector
widget.

-- 
Bastien Nocera <hadess@hadess.net> 

[-- Attachment #2: bluez-gnome-client-handle-all-adapters.patch --]
[-- Type: text/x-patch, Size: 3968 bytes --]

Index: common/client.c
===================================================================
RCS file: /cvsroot/bluez/gnome/common/client.c,v
retrieving revision 1.16
diff -u -p -r1.16 client.c
--- common/client.c	20 May 2007 12:04:32 -0000	1.16
+++ common/client.c	24 Jul 2007 16:12:18 -0000
@@ -59,7 +59,7 @@ static void bluetooth_client_init(Blueto
 
 static void bluetooth_client_finalize(GObject *object)
 {
-	//BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(object);
+	bluetooth_client_cancel_discovery(BLUETOOTH_CLIENT (object), NULL);
 }
 
 static void bluetooth_client_set_property(GObject *object, guint prop_id,
@@ -351,9 +351,7 @@ static void update_adapter(DBusGProxy *o
 	gtk_tree_store_set(store, iter, COLUMN_ADDRESS, address,
 						COLUMN_NAME, name, -1);
 
-	//adapter_list_remote_devices(object, &array, &error);
-
-	adapter_list_bondings(object, &array, &error);
+	adapter_list_remote_devices(object, &array, &error);
 
 	if (error == NULL) {
 		while (*array) {
@@ -587,11 +585,6 @@ BluetoothClient *bluetooth_client_new(vo
 	return BLUETOOTH_CLIENT(g_object_new(BLUETOOTH_TYPE_CLIENT, NULL));
 }
 
-void bluetooth_client_destroy(BluetoothClient *self)
-{
-	g_object_unref(self);
-}
-
 gboolean bluetooth_client_register_passkey_agent(BluetoothClient *self,
 		const char *path, const char *address, const void *info)
 {
@@ -652,8 +645,9 @@ gboolean bluetooth_client_create_bonding
 gboolean bluetooth_client_discover_devices(BluetoothClient *self, gchar *adapter)
 {
 	GtkTreeIter iter;
-	gboolean cont;
+	gboolean cont, retval;
 
+	retval = FALSE;
 	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
 
 	while (cont == TRUE) {
@@ -664,23 +658,27 @@ gboolean bluetooth_client_discover_devic
 						COLUMN_PATH, &path,
 						COLUMN_OBJECT, &object, -1);
 
-		if (g_ascii_strcasecmp(path, adapter) == 0) {
+		if ((adapter == NULL && path != NULL)
+		    || g_ascii_strcasecmp(path, adapter) == 0) {
 			dbus_g_proxy_call(object, "DiscoverDevices",
 							NULL, G_TYPE_INVALID);
-			return TRUE;
+			if (adapter != NULL)
+				return TRUE;
+			retval = TRUE;
 		}
 
 		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
 	}
 
-	return FALSE;
+	return retval;
 }
 
 gboolean bluetooth_client_cancel_discovery(BluetoothClient *self, gchar *adapter)
 {
 	GtkTreeIter iter;
-	gboolean cont;
+	gboolean cont, retval;
 
+	retval = FALSE;
 	cont = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
 
 	while (cont == TRUE) {
@@ -691,16 +689,19 @@ gboolean bluetooth_client_cancel_discove
 						COLUMN_PATH, &path,
 						COLUMN_OBJECT, &object, -1);
 
-		if (g_ascii_strcasecmp(path, adapter) == 0) {
+		if ((adapter == NULL && path != NULL)
+		    || g_ascii_strcasecmp(path, adapter) == 0) {
 			dbus_g_proxy_call(object, "CancelDiscovery",
 							NULL, G_TYPE_INVALID);
-			return TRUE;
+			if (adapter != NULL)
+				return TRUE;
+			retval = TRUE;
 		}
 
 		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
 	}
 
-	return FALSE;
+	return retval;
 }
 
 GtkTreeModel *bluetooth_client_get_model(BluetoothClient *self)
@@ -803,7 +804,8 @@ GtkTreeModel *bluetooth_client_get_model
 		gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
 						COLUMN_PATH, &path, -1);
 
-		if (!g_ascii_strcasecmp(path, adapter)) {
+		if ((adapter == NULL && path != NULL)
+		    || !g_ascii_strcasecmp(path, adapter)) {
 			GtkTreePath *path;
 
 			path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
Index: common/client.h
===================================================================
RCS file: /cvsroot/bluez/gnome/common/client.h,v
retrieving revision 1.11
diff -u -p -r1.11 client.h
--- common/client.h	3 Apr 2007 22:45:08 -0000	1.11
+++ common/client.h	24 Jul 2007 16:12:18 -0000
@@ -57,8 +57,6 @@ GType bluetooth_client_get_type(void);
 
 BluetoothClient *bluetooth_client_new(void);
 
-void bluetooth_client_destroy(BluetoothClient *self);
-
 enum {
 	COLUMN_PATH,
 	COLUMN_ACTIVE,

[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

             reply	other threads:[~2007-07-24 16:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-24 16:16 Bastien Nocera [this message]
2007-07-24 16:20 ` [Bluez-devel] [PATCH] Make BluetoothClient work on all adapters Bastien Nocera
2007-07-24 20:54   ` Marcel Holtmann
2007-07-24 21:12     ` Bastien Nocera
2007-07-24 21:26       ` Marcel Holtmann
2007-07-24 21:14 ` Marcel Holtmann
2007-07-24 22:10   ` Bastien Nocera
2007-07-24 23:09     ` Bastien Nocera
2007-07-25  6:51       ` Marcel Holtmann
2007-07-25  7:04       ` Marcel Holtmann
2007-07-25  7:33         ` Bastien Nocera
2007-07-25  7:53           ` Marcel Holtmann
2007-07-25  7:56             ` Bastien Nocera
2007-07-25  8:05               ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1185293793.3641.129.camel@cookie.hadess.net \
    --to=hadess@hadess.net \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox