diff --git a/Makefile.am b/Makefile.am
index 6a9c76f..52c49fb 100644
--- a/Makefile.am
+++ b/Makefile.am
src/error.h src/error.c \
src/manager.h src/manager.c \
src/adapter.h src/adapter.c \
- src/device.h src/device.c \
+ src/device.h src/device.c src/attio.h \
src/dbus-common.c src/dbus-common.h \
src/event.h src/event.c \
src/oob.h src/oob.c src/eir.h src/eir.c
diff --git a/src/attio.h b/src/attio.h
new file mode 100644
index 0000000..fad8516
--- /dev/null
+++ b/src/attio.h
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2011 Nokia Corporation
+ * Copyright (C) 2011 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+typedef void (*attio_connect_cb) (GAttrib *attrib, gpointer user_data);
+
+guint btd_device_add_attio_callback(struct btd_device *device,
+ attio_connect_cb func,
+ gpointer user_data);
diff --git a/src/device.c b/src/device.c
index 7b36f5b..ea9c0cd 100644
--- a/src/device.c
+++ b/src/device.c
#include "att.h"
#include "hcid.h"
#include "adapter.h"
+#include "gattrib.h"
+#include "attio.h"
#include "device.h"
#include "dbus-common.h"
#include "event.h"
#include "error.h"
#include "glib-helper.h"
-#include "gattrib.h"
#include "gatt.h"
#include "agent.h"
#include "sdp-xml.h"
guint listener_id;
};
+struct attio_data {
+ guint id;
+ attio_connect_cb func;
+ gpointer user_data;
+};
+
struct btd_device {
bdaddr_t bdaddr;
device_type_t type;
struct bonding_req *bonding;
struct authentication_req *authr; /* authentication request */
GSList *disconnects; /* disconnects message */
+ GSList *attios;
gboolean connected;
g_slist_free_full(device->services, g_free);
g_slist_free_full(device->uuids, g_free);
g_slist_free_full(device->primaries, g_free);
+ g_slist_free_full(device->attios, g_free);
if (device->tmp_records)
sdp_list_free(device->tmp_records,
emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Class",
DBUS_TYPE_UINT32, &value);
}
+
+guint btd_device_add_attio_callback(struct btd_device *device,
+ attio_connect_cb func,
+ gpointer user_data)
+{
+ struct attio_data *attio;
+ static guint attio_id = 0;
+
+ DBG("%p registered ATT connection callback", device);
+
+ attio = g_new0(struct attio_data, 1);
+ attio->id = ++attio_id;
+ attio->func = func;
+ attio->user_data = user_data;
+
+ device->attios = g_slist_append(device->attios, attio);
+
+ return attio->id;
+}