Diff between 437959a0b5c3dedef7e50606f8c96c8e84ee12d9 and 465e5fa6e209e3f67182e5849abb7c6fd31a4e4f

Changed Files

File Additions Deletions Status
src/bluetooth.conf +1 -1 modified
src/manager.c +2 -6 modified
src/profile.c +28 -7 modified
src/profile.h +1 -5 modified

Full Patch

diff --git a/src/bluetooth.conf b/src/bluetooth.conf
index 2db43d9..bd48cf9 100644
--- a/src/bluetooth.conf
+++ b/src/bluetooth.conf
@@ -17,7 +17,7 @@
     <allow send_interface="org.bluez.Watcher"/>
     <allow send_interface="org.bluez.ThermometerWatcher"/>
     <allow send_interface="org.bluez.AlertAgent"/>
-    <allow send_interface="org.bluez.Profile"/>
+    <allow send_interface="org.bluez.Profile1"/>
     <allow send_interface="org.bluez.HeartRateWatcher"/>
   </policy>
 
diff --git a/src/manager.c b/src/manager.c
index a96115b..4ea7821 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -163,12 +163,6 @@ static const GDBusMethodTable manager_methods[] = {
 			GDBUS_ARGS({ "pattern", "s" }),
 			GDBUS_ARGS({ "adapter", "o" }),
 			find_adapter) },
-	{ GDBUS_METHOD("RegisterProfile",
-			GDBUS_ARGS({ "profile", "o"}, { "UUID", "s" },
-						{ "options", "a{sv}" }),
-			NULL, btd_profile_reg_ext) },
-	{ GDBUS_METHOD("UnregisterProfile", GDBUS_ARGS({ "profile", "o" }),
-			NULL, btd_profile_unreg_ext) },
 	{ }
 };
 
@@ -189,6 +183,8 @@ static const GDBusPropertyTable manager_properties[] = {
 
 dbus_bool_t manager_init(const char *path)
 {
+	btd_profile_init();
+
 	snprintf(base_path, sizeof(base_path), "/org/bluez/%d", getpid());
 
 	return g_dbus_register_interface(btd_get_dbus_connection(),
diff --git a/src/profile.c b/src/profile.c
index bc76cca..7555c8c 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -168,7 +168,7 @@ static void ext_cancel(struct ext_profile *ext)
 	DBusMessage *msg;
 
 	msg = dbus_message_new_method_call(ext->owner, ext->path,
-						"org.bluez.Profile", "Cancel");
+						"org.bluez.Profile1", "Cancel");
 	if (msg)
 		g_dbus_send_message(btd_get_dbus_connection(), msg);
 }
@@ -314,7 +314,7 @@ static bool send_new_connection(struct ext_profile *ext, struct ext_io *conn,
 	int fd;
 
 	msg = dbus_message_new_method_call(ext->owner, ext->path,
-							"org.bluez.Profile",
+							"org.bluez.Profile1",
 							"NewConnection");
 	if (!msg) {
 		error("Unable to create NewConnection call for %s", ext->name);
@@ -1085,8 +1085,8 @@ static void ext_exited(DBusConnection *conn, void *user_data)
 	remove_ext(ext);
 }
 
-DBusMessage *btd_profile_reg_ext(DBusConnection *conn, DBusMessage *msg,
-							void *user_data)
+static DBusMessage *register_profile(DBusConnection *conn,
+					DBusMessage *msg, void *user_data)
 {
 	const char *path, *sender, *uuid;
 	DBusMessageIter args, opts;
@@ -1120,8 +1120,8 @@ DBusMessage *btd_profile_reg_ext(DBusConnection *conn, DBusMessage *msg,
 	return dbus_message_new_method_return(msg);
 }
 
-DBusMessage *btd_profile_unreg_ext(DBusConnection *conn, DBusMessage *msg,
-							void *user_data)
+static DBusMessage *unregister_profile(DBusConnection *conn,
+					DBusMessage *msg, void *user_data)
 {
 	const char *path, *sender;
 	struct ext_profile *ext;
@@ -1142,6 +1142,16 @@ DBusMessage *btd_profile_unreg_ext(DBusConnection *conn, DBusMessage *msg,
 	return dbus_message_new_method_return(msg);
 }
 
+static const GDBusMethodTable methods[] = {
+	{ GDBUS_METHOD("RegisterProfile",
+			GDBUS_ARGS({ "profile", "o"}, { "UUID", "s" },
+						{ "options", "a{sv}" }),
+			NULL, register_profile) },
+	{ GDBUS_METHOD("UnregisterProfile", GDBUS_ARGS({ "profile", "o" }),
+			NULL, unregister_profile) },
+	{ }
+};
+
 void btd_profile_add_custom_prop(const char *uuid, const char *type,
 					const char *name,
 					btd_profile_prop_exists exists,
@@ -1173,6 +1183,13 @@ static void free_property(gpointer data)
 	g_free(p);
 }
 
+void btd_profile_init(void)
+{
+	g_dbus_register_interface(btd_get_dbus_connection(),
+				"/org/bluez", "org.bluez.ProfileManager1",
+				methods, NULL, NULL, NULL, NULL);
+}
+
 void btd_profile_cleanup(void)
 {
 	while (ext_profiles) {
@@ -1186,7 +1203,7 @@ void btd_profile_cleanup(void)
 		ext->conns = NULL;
 
 		msg = dbus_message_new_method_call(ext->owner, ext->path,
-							"org.bluez.Profile",
+							"org.bluez.Profile1",
 							"Release");
 		if (msg)
 			g_dbus_send_message(conn, msg);
@@ -1198,4 +1215,8 @@ void btd_profile_cleanup(void)
 
 	g_slist_free_full(custom_props, free_property);
 	custom_props = NULL;
+
+	g_dbus_unregister_interface(btd_get_dbus_connection(),
+				"/org/bluez", "org.bluez.ProfileManager1");
+
 }
diff --git a/src/profile.h b/src/profile.h
index 7ece2bf..d7b1ba1 100644
--- a/src/profile.h
+++ b/src/profile.h
@@ -74,9 +74,5 @@ void btd_profile_add_custom_prop(const char *uuid, const char *type,
 					btd_profile_prop_get get,
 					void *user_data);
 
+void btd_profile_init(void);
 void btd_profile_cleanup(void);
-
-DBusMessage *btd_profile_reg_ext(DBusConnection *conn, DBusMessage *msg,
-							void *user_data);
-DBusMessage *btd_profile_unreg_ext(DBusConnection *conn, DBusMessage *msg,
-							void *user_data);