summaryrefslogtreecommitdiffstats
path: root/common/dbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/dbus.c')
-rw-r--r--common/dbus.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/common/dbus.c b/common/dbus.c
index 6a7eeb0f..e4bcbba5 100644
--- a/common/dbus.c
+++ b/common/dbus.c
@@ -645,3 +645,33 @@ int set_nonblocking(int fd)
return 0;
}
+
+void register_service(DBusConnection *conn, const char *identifier,
+ const char *name, const char *description)
+{
+ DBusMessage *msg, *reply;
+
+ info("Registering service");
+
+ msg = dbus_message_new_method_call("org.bluez", "/org/bluez",
+ "org.bluez.Database", "RegisterService");
+ if (!msg) {
+ error("Can't create service register method");
+ return;
+ }
+
+ dbus_message_append_args(msg, DBUS_TYPE_STRING, &identifier,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &description, DBUS_TYPE_INVALID);
+
+ reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, NULL);
+ if (!reply) {
+ error("Can't register service");
+ return;
+ }
+
+ dbus_message_unref(msg);
+ dbus_message_unref(reply);
+
+ dbus_connection_flush(conn);
+}