diff --git a/Makefile.am b/Makefile.am
index 4977a05..53b347c 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/profile.h src/profile.c \
src/device.h src/device.c src/attio.h \
src/dbus-common.c src/dbus-common.h \
src/event.h src/event.c \
diff --git a/audio/manager.c b/audio/manager.c
index 5c81957..99fcaf8 100644
--- a/audio/manager.c
+++ b/audio/manager.c
#include "../src/adapter.h"
#include "../src/manager.h"
#include "../src/device.h"
+#include "../src/profile.h"
#include "log.h"
#include "device.h"
diff --git a/profiles/deviceinfo/manager.c b/profiles/deviceinfo/manager.c
index 914ec40..982135e 100644
--- a/profiles/deviceinfo/manager.c
+++ b/profiles/deviceinfo/manager.c
#include "adapter.h"
#include "device.h"
+#include "profile.h"
#include "att.h"
#include "gattrib.h"
#include "gatt.h"
diff --git a/profiles/gatt/manager.c b/profiles/gatt/manager.c
index 9c5ea14..6a520b3 100644
--- a/profiles/gatt/manager.c
+++ b/profiles/gatt/manager.c
#include "adapter.h"
#include "device.h"
+#include "profile.h"
#include "att.h"
#include "gattrib.h"
#include "gatt.h"
diff --git a/profiles/health/hdp_manager.c b/profiles/health/hdp_manager.c
index 416286e..1f899dc 100644
--- a/profiles/health/hdp_manager.c
+++ b/profiles/health/hdp_manager.c
#include <btio.h>
#include <adapter.h>
#include <device.h>
+#include <profile.h>
#include <glib-helper.h>
#include <log.h>
diff --git a/profiles/input/hog_manager.c b/profiles/input/hog_manager.c
index 6d971fa..8272640 100644
--- a/profiles/input/hog_manager.c
+++ b/profiles/input/hog_manager.c
#include "log.h"
#include "../src/adapter.h"
#include "../src/device.h"
+#include "../src/profile.h"
#include "plugin.h"
#include "hcid.h"
diff --git a/profiles/input/manager.c b/profiles/input/manager.c
index 58c3694..3b494f5 100644
--- a/profiles/input/manager.c
+++ b/profiles/input/manager.c
#include "log.h"
#include "../src/adapter.h"
#include "../src/device.h"
+#include "../src/profile.h"
#include "device.h"
#include "hog_device.h"
diff --git a/profiles/network/manager.c b/profiles/network/manager.c
index ac36406..9ab3a8b 100644
--- a/profiles/network/manager.c
+++ b/profiles/network/manager.c
#include "adapter.h"
#include "device.h"
+#include "profile.h"
#include "manager.h"
#include "common.h"
#include "connection.h"
diff --git a/profiles/proximity/manager.c b/profiles/proximity/manager.c
index 7fa00b4..39c2bfe 100644
--- a/profiles/proximity/manager.c
+++ b/profiles/proximity/manager.c
#include "adapter.h"
#include "device.h"
+#include "profile.h"
#include "att.h"
#include "gattrib.h"
#include "gatt.h"
diff --git a/profiles/sap/manager.c b/profiles/sap/manager.c
index b563d7b..ecf672e 100644
--- a/profiles/sap/manager.c
+++ b/profiles/sap/manager.c
#include "log.h"
#include "adapter.h"
#include "device.h"
+#include "profile.h"
#include "manager.h"
#include "server.h"
diff --git a/profiles/thermometer/manager.c b/profiles/thermometer/manager.c
index 9bbba67..4a894cf 100644
--- a/profiles/thermometer/manager.c
+++ b/profiles/thermometer/manager.c
#include "adapter.h"
#include "device.h"
+#include "profile.h"
#include "att.h"
#include "gattrib.h"
#include "gatt.h"
diff --git a/profiles/time/manager.c b/profiles/time/manager.c
index c29951c..8dab12f 100644
--- a/profiles/time/manager.c
+++ b/profiles/time/manager.c
#include "manager.h"
#include "adapter.h"
#include "device.h"
+#include "profile.h"
#include "server.h"
struct btd_profile time_profile = {
diff --git a/src/adapter.c b/src/adapter.c
index 4b675e8..1c13b2d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
#include "adapter.h"
#include "manager.h"
#include "device.h"
+#include "profile.h"
#include "dbus-common.h"
#include "error.h"
#include "glib-helper.h"
diff --git a/src/device.c b/src/device.c
index 02ef35e..49021e4 100644
--- a/src/device.c
+++ b/src/device.c
#include "gattrib.h"
#include "attio.h"
#include "device.h"
+#include "profile.h"
#include "dbus-common.h"
#include "error.h"
#include "glib-helper.h"
guint cleanup_id;
};
-static GSList *profiles = NULL;
-
static uint16_t uuid_list[] = {
L2CAP_UUID,
PNP_INFO_SVCLASS_ID,
DBG("Probing profiles for device %s", addr);
- for (l = profiles; l != NULL; l = g_slist_next(l)) {
+ for (l = btd_get_profiles(); l != NULL; l = g_slist_next(l)) {
struct btd_profile *profile = l->data;
GSList *probe_uuids;
int err;
device_set_version(device, product_ver);
}
-void btd_profile_foreach(void (*func)(struct btd_profile *p, void *data),
- void *data)
-{
- GSList *l, *next;
-
- for (l = profiles; l != NULL; l = next) {
- struct btd_profile *profile = l->data;
-
- next = g_slist_next(l);
-
- func(profile, data);
- }
-}
-
-int btd_profile_register(struct btd_profile *profile)
-{
- profiles = g_slist_append(profiles, profile);
- return 0;
-}
-
-void btd_profile_unregister(struct btd_profile *profile)
-{
- profiles = g_slist_remove(profiles, profile);
-}
-
-void btd_profile_connected(struct btd_profile *profile,
- struct btd_device *device, int err)
-{
- if (err == 0)
- device->conns = g_slist_append(device->conns, profile);
-}
-
-void btd_profile_disconnected(struct btd_profile *profile,
- struct btd_device *device)
-{
- device->conns = g_slist_remove(device->conns, profile);
-}
diff --git a/src/device.h b/src/device.h
index f1d95c6..9426ef8 100644
--- a/src/device.h
+++ b/src/device.h
AUTH_TYPE_NOTIFY_PINCODE,
} auth_type_t;
-#define BTD_UUIDS(args...) ((const char *[]) { args, NULL } )
-
-struct btd_profile {
- const char *name;
-
- const char *local_uuid;
- const char **remote_uuids;
-
- bool auto_connect;
-
- int (*device_probe) (struct btd_device *device, GSList *uuids);
- void (*device_remove) (struct btd_device *device);
-
- void (*connect) (struct btd_device *device);
- void (*disconnect) (struct btd_device *device);
-
- int (*adapter_probe) (struct btd_adapter *adapter);
- void (*adapter_remove) (struct btd_adapter *adapter);
-};
-
-void btd_profile_foreach(void (*func)(struct btd_profile *p, void *data),
- void *data);
-
-int btd_profile_register(struct btd_profile *profile);
-void btd_profile_unregister(struct btd_profile *profile);
-
-void btd_profile_connected(struct btd_profile *profile,
- struct btd_device *device, int err);
-void btd_profile_disconnected(struct btd_profile *profile,
- struct btd_device *device);
-
struct btd_device *device_create(DBusConnection *conn,
struct btd_adapter *adapter,
const char *address, uint8_t bdaddr_type);
diff --git a/src/profile.c b/src/profile.c
new file mode 100644
index 0000000..71861f5
--- /dev/null
+++ b/src/profile.c
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ *
+ * 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
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include <glib.h>
+#include <dbus/dbus.h>
+
+#include "adapter.h"
+#include "device.h"
+#include "profile.h"
+
+static GSList *profiles = NULL;
+
+void btd_profile_foreach(void (*func)(struct btd_profile *p, void *data),
+ void *data)
+{
+ GSList *l, *next;
+
+ for (l = profiles; l != NULL; l = next) {
+ struct btd_profile *profile = l->data;
+
+ next = g_slist_next(l);
+
+ func(profile, data);
+ }
+}
+
+int btd_profile_register(struct btd_profile *profile)
+{
+ profiles = g_slist_append(profiles, profile);
+ return 0;
+}
+
+void btd_profile_unregister(struct btd_profile *profile)
+{
+ profiles = g_slist_remove(profiles, profile);
+}
+
+GSList *btd_get_profiles(void)
+{
+ return profiles;
+}
diff --git a/src/profile.h b/src/profile.h
new file mode 100644
index 0000000..9088c32
--- /dev/null
+++ b/src/profile.h
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ *
+ * 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
+ *
+ */
+
+#define BTD_UUIDS(args...) ((const char *[]) { args, NULL } )
+
+struct btd_profile {
+ const char *name;
+
+ const char *local_uuid;
+ const char **remote_uuids;
+
+ bool auto_connect;
+
+ int (*device_probe) (struct btd_device *device, GSList *uuids);
+ void (*device_remove) (struct btd_device *device);
+
+ void (*connect) (struct btd_device *device);
+ void (*disconnect) (struct btd_device *device);
+
+ int (*adapter_probe) (struct btd_adapter *adapter);
+ void (*adapter_remove) (struct btd_adapter *adapter);
+};
+
+void btd_profile_foreach(void (*func)(struct btd_profile *p, void *data),
+ void *data);
+
+int btd_profile_register(struct btd_profile *profile);
+void btd_profile_unregister(struct btd_profile *profile);
+
+GSList *btd_get_profiles(void);