diff --git a/src/bluetooth.conf b/src/bluetooth.conf
index 2db43d9..bd48cf9 100644
--- a/src/bluetooth.conf
+++ b/src/bluetooth.conf
<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
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) },
{ }
};
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
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);
}
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);
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;
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;
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,
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) {
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);
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
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);