aboutsummaryrefslogtreecommitdiffstats
path: root/attrib/manager.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2010-07-05 19:07:26 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2010-08-09 18:06:43 -0400
commit44a3a09fffc52f6848a9f0ce90fcb92d7cece0a8 (patch)
tree8461a81041bc9f9c44f60e12c5d4c4ffdc83ec3e /attrib/manager.c
parentc0abb9dc3926fb58aea28544b8aab724038bd358 (diff)
downloadbluez-44a3a09fffc52f6848a9f0ce90fcb92d7cece0a8.tar.gz
bluez-44a3a09fffc52f6848a9f0ce90fcb92d7cece0a8.tar.xz
bluez-44a3a09fffc52f6848a9f0ce90fcb92d7cece0a8.zip
Add stubs for the attribute client
Contains device driver declaration for attribute protocol. Registers D-Bus path/interface to represent the remote device client: BR/EDR or LE. For the most common LE scenarios, devices running BlueZ will be client role.
Diffstat (limited to 'attrib/manager.c')
-rw-r--r--attrib/manager.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/attrib/manager.c b/attrib/manager.c
index d08a83b4..9b99f16b 100644
--- a/attrib/manager.c
+++ b/attrib/manager.c
@@ -25,18 +25,36 @@
#include <config.h>
#endif
-#include <errno.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-#include <gdbus.h>
-
-#include "log.h"
#include "../src/adapter.h"
+#include "../src/device.h"
#include "manager.h"
+#include "client.h"
+
+#define GATT_UUID "00001801-0000-1000-8000-00805f9b34fb"
+
+static DBusConnection *connection;
+
+static int client_probe(struct btd_device *device, GSList *uuids)
+{
+ const char *path = device_get_path(device);
+
+ return attrib_client_register(path);
+}
+
+static void client_remove(struct btd_device *device)
+{
+ const char *path = device_get_path(device);
-static DBusConnection *connection = NULL;
+ attrib_client_unregister(path);
+}
+
+static struct btd_device_driver client_driver = {
+ .name = "gatt-client",
+ .uuids = BTD_UUIDS(GATT_UUID),
+ .probe = client_probe,
+ .remove = client_remove,
+};
static int server_probe(struct btd_adapter *adapter)
{
@@ -57,7 +75,10 @@ int attrib_manager_init(DBusConnection *conn)
{
connection = dbus_connection_ref(conn);
+ attrib_client_init(connection);
+
btd_register_adapter_driver(&attrib_server_driver);
+ btd_register_device_driver(&client_driver);
return 0;
}
@@ -65,6 +86,8 @@ int attrib_manager_init(DBusConnection *conn)
void attrib_manager_exit(void)
{
btd_unregister_adapter_driver(&attrib_server_driver);
+ btd_unregister_device_driver(&client_driver);
+ attrib_client_exit();
dbus_connection_unref(connection);
}