diff options
author | Luiz Augusto von Dentz <luiz.dentz@indt.org.br> | 2008-08-05 17:22:52 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@indt.org.br> | 2008-08-05 18:26:40 -0300 |
commit | 00acfa685e3e73c619146b7ca39068eb304f1ce8 (patch) | |
tree | bd6281604d6d256625c615b98cf2a3d19fe0be0e | |
parent | 6a3bd6d20c655f43e061db0473861e9698fa7cba (diff) |
Add initial implementation of adapter driver.
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/manager.c | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 32ad8f67..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 \ - server.h server.c manager.h manager.c error.h error.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/manager.c b/src/manager.c index cda45f4c..fc0c8738 100644 --- a/src/manager.c +++ b/src/manager.c @@ -59,7 +59,7 @@ #include "oui.h" #include "agent.h" #include "device.h" -#include "glib-helper.h" +#include "driver.h" #include "manager.h" @@ -443,14 +443,17 @@ static void manager_remove_adapter(struct adapter *adapter) int manager_register_adapter(int id) { struct adapter *adapter = adapter_create(connection, id); - const gchar *path; + GSList *l = btd_get_adapter_drivers(); if (!adapter) return -1; - path = adapter_get_path(adapter); + for (; l; l = l->next) { + struct btd_adapter_driver *driver = l->data; - __probe_servers(path); + if (driver->probe) + driver->probe(driver, (struct btd_adapter *) adapter); + } manager_add_adapter(adapter); @@ -461,6 +464,7 @@ int manager_unregister_adapter(int id) { struct adapter *adapter; const gchar *path; + GSList *l = btd_get_adapter_drivers(); adapter = manager_find_adapter_by_id(id); if (!adapter) @@ -470,7 +474,12 @@ int manager_unregister_adapter(int id) info("Unregister path: %s", path); - __remove_servers(path); + for (; l; l = l->next) { + struct btd_adapter_driver *driver = l->data; + + if (driver->remove) + driver->remove(driver, (struct btd_adapter *) adapter); + } adapter_stop(adapter); |