summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-11-01 00:54:45 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-11-01 00:54:45 +0100
commit1700790d948d11ffa8526befa0045a26f707f187 (patch)
treef2e3301f0a2ade0c6d869a1a2c624e228d2ea4fa
parentc4918c93aa30f2e3363e288989180124d3931118 (diff)
Add method for requesting/releasing the any adapter object path
-rw-r--r--src/adapter.c25
-rw-r--r--src/adapter.h5
2 files changed, 29 insertions, 1 deletions
diff --git a/src/adapter.c b/src/adapter.c
index c10b24f3..0c28ac5e 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3397,3 +3397,28 @@ void adapter_update_devices(struct btd_adapter *adapter)
DBUS_TYPE_OBJECT_PATH, &devices);
g_free(devices);
}
+
+static gchar *adapter_any_path = NULL;
+static int adapter_any_refcount = 0;
+
+const char *btd_adapter_any_request_path(void)
+{
+ if (adapter_any_refcount > 0)
+ return adapter_any_path;
+
+ adapter_any_path = g_strdup_printf("%s/any", manager_get_base_path());
+ adapter_any_refcount++;
+
+ return adapter_any_path;
+}
+
+void btd_adapter_any_release_path(void)
+{
+ adapter_any_refcount--;
+
+ if (adapter_any_refcount > 0)
+ return;
+
+ g_free(adapter_any_path);
+ adapter_any_path = NULL;
+}
diff --git a/src/adapter.h b/src/adapter.h
index 0983f140..e5312685 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -159,7 +159,7 @@ void adapter_remove_active_conn(struct btd_adapter *adapter,
struct active_conn_info *dev);
void adapter_update_devices(struct btd_adapter *adapter);
struct active_conn_info *adapter_search_active_conn_by_bdaddr(struct btd_adapter *adapter,
- bdaddr_t *bda);
+ bdaddr_t *bda);
struct active_conn_info *adapter_search_active_conn_by_handle(struct btd_adapter *adapter,
uint16_t handle);
void adapter_free_bonding_request(struct btd_adapter *adapter);
@@ -179,3 +179,6 @@ void btd_unregister_adapter_driver(struct btd_adapter_driver *driver);
int btd_request_authorization(const bdaddr_t *src, const bdaddr_t *dst,
const char *uuid, service_auth_cb cb, void *user_data);
int btd_cancel_authorization(const bdaddr_t *src, const bdaddr_t *dst);
+
+const char *btd_adapter_any_request_path(void);
+void btd_adapter_any_release_path(void);