aboutsummaryrefslogtreecommitdiffstats
path: root/attrib/manager.c
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2011-03-28 19:40:46 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2011-03-30 19:15:43 +0300
commitc6477c3cccb3fb160985bfab8604d31d1e2a66f0 (patch)
treeaced954b2b2830e7f5c34713cfe401b877654244 /attrib/manager.c
parentc602de90fb31a0c517fb9d62df99f8ff624379ce (diff)
downloadbluez-c6477c3cccb3fb160985bfab8604d31d1e2a66f0.tar.gz
bluez-c6477c3cccb3fb160985bfab8604d31d1e2a66f0.tar.xz
bluez-c6477c3cccb3fb160985bfab8604d31d1e2a66f0.zip
Move Attrib client to the core
Diffstat (limited to 'attrib/manager.c')
-rw-r--r--attrib/manager.c62
1 files changed, 3 insertions, 59 deletions
diff --git a/attrib/manager.c b/attrib/manager.c
index a5a7de43..7c057205 100644
--- a/attrib/manager.c
+++ b/attrib/manager.c
@@ -26,66 +26,16 @@
#include <config.h>
#endif
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/sdp.h>
-#include <bluetooth/sdp_lib.h>
+#include <stdint.h>
+#include <glib.h>
-#include "../src/adapter.h"
-#include "../src/device.h"
#include "hcid.h"
#include "manager.h"
-#include "client.h"
#include "example.h"
-#define GATT_UUID "00001801-0000-1000-8000-00805f9b34fb"
-
-static DBusConnection *connection;
-
-static int client_probe(struct btd_device *device, GSList *uuids)
+int attrib_manager_init(void)
{
- const sdp_record_t *rec;
- int psm = -1;
-
- rec = btd_device_get_record(device, GATT_UUID);
- if (rec) {
- sdp_list_t *list;
- if (sdp_get_access_protos(rec, &list) < 0)
- return -1;
-
- psm = sdp_get_proto_port(list, L2CAP_UUID);
-
- sdp_list_foreach(list, (sdp_list_func_t) sdp_list_free, NULL);
- sdp_list_free(list, NULL);
-
- if (psm < 0)
- return -1;
- }
-
- return attrib_client_register(device, psm);
-}
-
-static void client_remove(struct btd_device *device)
-{
- attrib_client_unregister(device);
-}
-
-static struct btd_device_driver client_driver = {
- .name = "gatt-client",
- .uuids = BTD_UUIDS(GATT_UUID),
- .probe = client_probe,
- .remove = client_remove,
-};
-
-int attrib_manager_init(DBusConnection *conn)
-{
- connection = dbus_connection_ref(conn);
-
- attrib_client_init(connection);
-
- btd_register_device_driver(&client_driver);
-
-
if (main_opts.attrib_server)
return server_example_init();
@@ -94,12 +44,6 @@ int attrib_manager_init(DBusConnection *conn)
void attrib_manager_exit(void)
{
- btd_unregister_device_driver(&client_driver);
-
if (main_opts.attrib_server)
server_example_exit();
-
- attrib_client_exit();
-
- dbus_connection_unref(connection);
}