--- health/hdp.c | 27 ++++++++++++++++++++++++--- src/bluetooth.conf | 1 + 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/health/hdp.c b/health/hdp.c index e99e00a..f7146eb 100644 --- a/health/hdp.c +++ b/health/hdp.c @@ -760,14 +760,35 @@ static void mcl_connected(struct mcap_mcl *mcl, gpointer data) { struct hdp_instance *hdpi = data; struct hdp_link *hdpl; + DBusMessage* message; GError *err = NULL; debug("mcl_connected"); + + message = dbus_message_new_method_call(hdpi->aname, hdpi->apath, + HEALTH_AGENT, "LinkConnected"); + if (!message) { + error("Couldn't allocate D-Bus message"); + return; + } + hdpl = create_health_link(hdpi, mcl, &err); - if (err) + if (err) { + dbus_message_unref(message); return; - /* TODO: Send the notification to the Agent */ - hdpi->hlink = g_slist_prepend(hdpi->hlink, hdpl); + } + + dbus_message_append_args(message, + DBUS_TYPE_OBJECT_PATH, &hdpl->path, + DBUS_TYPE_INVALID); + + if (g_dbus_send_message(hdpi->adapter->conn, message)) { + hdpi->hlink = g_slist_prepend(hdpi->hlink, hdpl); + return; + } + error("D-Bus send failed"); + health_link_free(hdpl); + dbus_message_unref(message); } static void mcl_reconnected(struct mcap_mcl *mcl, gpointer data) diff --git a/src/bluetooth.conf b/src/bluetooth.conf index 56e7a83..4471da5 100644 --- a/src/bluetooth.conf +++ b/src/bluetooth.conf @@ -12,6 +12,7 @@ <allow send_destination="org.bluez"/> <allow send_interface="org.bluez.Agent"/> <allow send_interface="org.bluez.HandsfreeAgent"/> + <allow send_interface="org.bluez.HealthAgent"/> </policy> <policy at_console="true"> -- 1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html