diff options
| -rw-r--r-- | plugins/echo.c | 23 | ||||
| -rw-r--r-- | src/Makefile.am | 2 | ||||
| -rw-r--r-- | src/dbus-service.c | 1 | ||||
| -rw-r--r-- | src/driver.h | 8 | ||||
| -rw-r--r-- | src/manager.c | 4 | ||||
| -rw-r--r-- | src/server.c | 68 | ||||
| -rw-r--r-- | src/server.h | 31 | 
7 files changed, 20 insertions, 117 deletions
| diff --git a/plugins/echo.c b/plugins/echo.c index 2c549089..7a5ad8d8 100644 --- a/plugins/echo.c +++ b/plugins/echo.c @@ -37,7 +37,8 @@  #include <gdbus.h>  #include "plugin.h" -#include "server.h" +#include "adapter.h" +#include "driver.h"  #include "logging.h"  static gboolean session_event(GIOChannel *chan, @@ -123,24 +124,28 @@ static GIOChannel *setup_rfcomm(uint8_t channel)  static GIOChannel *chan = NULL; -static int echo_probe(const char *adapter) +static int echo_probe(struct adapter *adapter)  { -	debug("echo probe adapter %s", adapter); +	const char *path = adapter_get_path(adapter); + +	DBG("path %s", path);  	chan = setup_rfcomm(23);  	return 0;  } -static void echo_remove(const char *adapter) +static void echo_remove(struct adapter *adapter)  { -	debug("echo remove adapter %s", adapter); +	const char *path = adapter_get_path(adapter); + +	DBG("path %s", path);  	g_io_channel_unref(chan);  } -static struct bt_server echo_server = { -	.uuid	= "00001101-0000-1000-8000-00805F9B34FB", +static struct btd_adapter_driver echo_server = { +	.name	= "echo-server",  	.probe	= echo_probe,  	.remove	= echo_remove,  }; @@ -149,14 +154,14 @@ static int echo_init(void)  {  	debug("Setup echo plugin"); -	return bt_register_server(&echo_server); +	return btd_register_adapter_driver(&echo_server);  }  static void echo_exit(void)  {  	debug("Cleanup echo plugin"); -	bt_unregister_server(&echo_server); +	btd_unregister_adapter_driver(&echo_server);  }  BLUETOOTH_PLUGIN_DEFINE("echo", echo_init, echo_exit) diff --git a/src/Makefile.am b/src/Makefile.am index 7f0e72e5..4b504add 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ sbin_PROGRAMS = bluetoothd  bluetoothd_SOURCES = main.c hcid.h sdpd.h \  	sdpd-server.c sdpd-request.c sdpd-service.c \  	sdpd-database.c security.c storage.c \ -	manager.h manager.c error.h error.c server.h server.c \ +	manager.h manager.c error.h error.c \  	adapter.h adapter.c device.h device.c plugin.h plugin.c \  	dbus-common.c dbus-common.h dbus-hci.h dbus-hci.c \  	dbus-database.c dbus-database.h dbus-service.c dbus-service.h \ diff --git a/src/dbus-service.c b/src/dbus-service.c index a85c3d8a..6673575c 100644 --- a/src/dbus-service.c +++ b/src/dbus-service.c @@ -46,7 +46,6 @@  #include <gdbus.h>  #include "hcid.h" -#include "server.h"  #include "dbus-common.h"  #include "error.h"  #include "manager.h" diff --git a/src/driver.h b/src/driver.h index 6ed56d53..a69ebab1 100644 --- a/src/driver.h +++ b/src/driver.h @@ -39,14 +39,12 @@ int btd_register_device_driver(struct btd_device_driver *driver);  void btd_unregister_device_driver(struct btd_device_driver *driver);  GSList *btd_get_device_drivers(void); -struct btd_adapter; +struct adapter;  struct btd_adapter_driver {  	const char *name; -	int (*probe) (struct btd_adapter_driver *driver, -			struct btd_adapter *adapter); -	void (*remove) (struct btd_adapter_driver *driver, -			struct btd_adapter *adapter); +	int (*probe) (struct adapter *adapter); +	void (*remove) (struct adapter *adapter);  };  int btd_register_adapter_driver(struct btd_adapter_driver *driver); diff --git a/src/manager.c b/src/manager.c index fc0c8738..51fb6011 100644 --- a/src/manager.c +++ b/src/manager.c @@ -452,7 +452,7 @@ int manager_register_adapter(int id)  		struct btd_adapter_driver *driver = l->data;  		if (driver->probe) -			driver->probe(driver, (struct btd_adapter *) adapter); +			driver->probe(adapter);  	}  	manager_add_adapter(adapter); @@ -478,7 +478,7 @@ int manager_unregister_adapter(int id)  		struct btd_adapter_driver *driver = l->data;  		if (driver->remove) -			driver->remove(driver, (struct btd_adapter *) adapter); +			driver->remove(adapter);  	}  	adapter_stop(adapter); diff --git a/src/server.c b/src/server.c deleted file mode 100644 index da240112..00000000 --- a/src/server.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - *  BlueZ - Bluetooth protocol stack for Linux - * - *  Copyright (C) 2004-2008  Marcel Holtmann <marcel@holtmann.org> - * - * - *  This program is free software; you can redistribute it and/or modify - *  it under the terms of the GNU General Public License as published by - *  the Free Software Foundation; either version 2 of the License, or - *  (at your option) any later version. - * - *  This program is distributed in the hope that it will be useful, - *  but WITHOUT ANY WARRANTY; without even the implied warranty of - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - *  GNU General Public License for more details. - * - *  You should have received a copy of the GNU General Public License - *  along with this program; if not, write to the Free Software - *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> - -#include "server.h" - -static GSList *servers = NULL; - -int bt_register_server(struct bt_server *server) -{ -	servers = g_slist_append(servers, server); - -	return 0; -} - -void bt_unregister_server(struct bt_server *server) -{ -	servers = g_slist_remove(servers, server); -} - -void __probe_servers(const char *adapter) -{ -	GSList *list; - -	for (list = servers; list; list = list->next) { -		struct bt_server *server = list->data; - -		if (server->probe) -			server->probe(adapter); -	} -} - -void __remove_servers(const char *adapter) -{ -	GSList *list; - -	for (list = servers; list; list = list->next) { -		struct bt_server *server = list->data; - -		if (server->remove) -			server->remove(adapter); -	} -} diff --git a/src/server.h b/src/server.h deleted file mode 100644 index f60ab88b..00000000 --- a/src/server.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * - *  BlueZ - Bluetooth protocol stack for Linux - * - *  Copyright (C) 2004-2008  Marcel Holtmann <marcel@holtmann.org> - * - * - *  This program is free software; you can redistribute it and/or modify - *  it under the terms of the GNU General Public License as published by - *  the Free Software Foundation; either version 2 of the License, or - *  (at your option) any later version. - * - *  This program is distributed in the hope that it will be useful, - *  but WITHOUT ANY WARRANTY; without even the implied warranty of - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - *  GNU General Public License for more details. - * - *  You should have received a copy of the GNU General Public License - *  along with this program; if not, write to the Free Software - *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA - * - */ - -struct bt_server { -	const char *uuid; -	int (*probe) (const char *adapter); -	void (*remove) (const char *adapter); -}; - -int bt_register_server(struct bt_server *server); -void bt_unregister_server(struct bt_server *server); | 
