summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-03-12 19:21:33 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-03-12 19:21:33 +0000
commit9a3a941ae455e4481392fb3e5d6b87750d0d9609 (patch)
tree111b3c13c607e9640662b1a86c492b62a33af0c6 /hcid
parentcf551c7e70305a99064362b048ef1ccb2da07aa9 (diff)
Hook up server probe/remove callbacks
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-hci.c4
-rw-r--r--hcid/hcid.h2
-rw-r--r--hcid/server.c24
-rw-r--r--hcid/server.h2
4 files changed, 32 insertions, 0 deletions
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index 62209956..69c289d6 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -378,6 +378,8 @@ int unregister_adapter_path(const char *path)
info("Unregister path: %s", path);
+ __remove_servers(path);
+
dbus_connection_get_object_user_data(connection, path,
(void *) &adapter);
@@ -515,6 +517,8 @@ int hcid_dbus_register_device(uint16_t id)
DBUS_TYPE_STRING, &pptr,
DBUS_TYPE_INVALID);
+ __probe_servers(path);
+
return 0;
failed:
diff --git a/hcid/hcid.h b/hcid/hcid.h
index 98dcd366..03b12807 100644
--- a/hcid/hcid.h
+++ b/hcid/hcid.h
@@ -213,3 +213,5 @@ int write_device_profiles(bdaddr_t *src, bdaddr_t *dst, const char *profiles);
gboolean plugin_init(void);
void plugin_cleanup(void);
+void __probe_servers(const char *adapter);
+void __remove_servers(const char *adapter);
diff --git a/hcid/server.c b/hcid/server.c
index 70bed47a..da240112 100644
--- a/hcid/server.c
+++ b/hcid/server.c
@@ -42,3 +42,27 @@ 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/hcid/server.h b/hcid/server.h
index 5c0f86dc..f60ab88b 100644
--- a/hcid/server.h
+++ b/hcid/server.h
@@ -23,6 +23,8 @@
struct bt_server {
const char *uuid;
+ int (*probe) (const char *adapter);
+ void (*remove) (const char *adapter);
};
int bt_register_server(struct bt_server *server);