diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-04-11 13:31:25 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-04-11 13:31:25 +0000 |
commit | c1c8c6366c341a90c2f22741e52b225171a1d3c5 (patch) | |
tree | b9b197e2000e418a89be3e77eb72a367f6e0f65a /hcid/dbus-service.c | |
parent | e0a2f55119eae4b8670a748205525ecff9bda5ae (diff) |
Add signals for adding and removing trust
Diffstat (limited to 'hcid/dbus-service.c')
-rw-r--r-- | hcid/dbus-service.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index d9ce3536..803bef13 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -511,7 +511,7 @@ static DBusHandlerResult set_trusted(DBusConnection *conn, DBusMessage *msg, void *data) { struct service *service = data; - DBusMessage *reply; + DBusMessage *reply, *signal; const char *address; if (!dbus_message_get_args(msg, NULL, @@ -526,8 +526,17 @@ static DBusHandlerResult set_trusted(DBusConnection *conn, if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; + signal = dbus_message_new_signal(service->object_path, + SERVICE_INTERFACE, "TrustAdded"); + if (!signal) + return DBUS_HANDLER_RESULT_NEED_MEMORY; + write_trust(BDADDR_ANY, address, service->ident, TRUE); + dbus_message_append_args(signal, DBUS_TYPE_STRING, &address, + DBUS_TYPE_INVALID); + send_message_and_unref(conn, signal); + return send_message_and_unref(conn, reply); } @@ -564,7 +573,7 @@ static DBusHandlerResult remove_trust(DBusConnection *conn, DBusMessage *msg, void *data) { struct service *service = data; - DBusMessage *reply; + DBusMessage *reply, *signal; const char *address; if (!dbus_message_get_args(msg, NULL, @@ -575,12 +584,21 @@ static DBusHandlerResult remove_trust(DBusConnection *conn, if (check_address(address) < 0) return error_invalid_arguments(conn, msg); - write_trust(BDADDR_ANY, address, service->ident, FALSE); - reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; + signal = dbus_message_new_signal(service->object_path, + SERVICE_INTERFACE, "TrustRemoved"); + if (!signal) + return DBUS_HANDLER_RESULT_NEED_MEMORY; + + write_trust(BDADDR_ANY, address, service->ident, FALSE); + + dbus_message_append_args(signal, DBUS_TYPE_STRING, &address, + DBUS_TYPE_INVALID); + send_message_and_unref(conn, signal); + return send_message_and_unref(conn, reply); } |