Diff between 06a7852b69eda34ad5da609897c46191cffc4973 and b1cde69a66270076ff5afb86250b29dd4fa53256

Changed Files

File Additions Deletions Status
Makefile.am +1 -0 modified
audio/manager.c +1 -0 modified
profiles/deviceinfo/manager.c +1 -0 modified
profiles/gatt/manager.c +1 -0 modified
profiles/health/hdp_manager.c +1 -0 modified
profiles/input/hog_manager.c +1 -0 modified
profiles/input/manager.c +1 -0 modified
profiles/network/manager.c +1 -0 modified
profiles/proximity/manager.c +1 -0 modified
profiles/sap/manager.c +1 -0 modified
profiles/thermometer/manager.c +1 -0 modified
profiles/time/manager.c +1 -0 modified
src/adapter.c +1 -0 modified
src/device.c +2 -40 modified
src/device.h +0 -31 modified
src/profile.c +68 -0 added
src/profile.h +50 -0 added

Full Patch

diff --git a/Makefile.am b/Makefile.am
index 4977a05..53b347c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -294,6 +294,7 @@ src_bluetoothd_SOURCES = $(gdbus_sources) $(builtin_sources) \
 			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
@@ -53,6 +53,7 @@
 #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
@@ -27,6 +27,7 @@
 
 #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
@@ -27,6 +27,7 @@
 
 #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
@@ -33,6 +33,7 @@
 #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
@@ -32,6 +32,7 @@
 #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
@@ -36,6 +36,7 @@
 #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
@@ -39,6 +39,7 @@
 
 #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
@@ -34,6 +34,7 @@
 
 #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
@@ -27,6 +27,7 @@
 #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
@@ -27,6 +27,7 @@
 
 #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
@@ -31,6 +31,7 @@
 #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
@@ -51,6 +51,7 @@
 #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
@@ -53,6 +53,7 @@
 #include "gattrib.h"
 #include "attio.h"
 #include "device.h"
+#include "profile.h"
 #include "dbus-common.h"
 #include "error.h"
 #include "glib-helper.h"
@@ -171,8 +172,6 @@ struct btd_device {
 	guint		cleanup_id;
 };
 
-static GSList *profiles = NULL;
-
 static uint16_t uuid_list[] = {
 	L2CAP_UUID,
 	PNP_INFO_SVCLASS_ID,
@@ -1294,7 +1293,7 @@ void device_probe_profiles(struct btd_device *device, GSList *uuids)
 
 	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;
@@ -3226,40 +3225,3 @@ void device_set_pnpid(struct btd_device *device, uint8_t vendor_id_src,
 	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
@@ -34,37 +34,6 @@ typedef enum {
 	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
@@ -0,0 +1,68 @@
+/*
+ *
+ *  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
@@ -0,0 +1,50 @@
+/*
+ *
+ *  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);