summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-adapter.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-04-11 13:31:25 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-04-11 13:31:25 +0000
commitc1c8c6366c341a90c2f22741e52b225171a1d3c5 (patch)
treeb9b197e2000e418a89be3e77eb72a367f6e0f65a /hcid/dbus-adapter.c
parente0a2f55119eae4b8670a748205525ecff9bda5ae (diff)
Add signals for adding and removing trust
Diffstat (limited to 'hcid/dbus-adapter.c')
-rw-r--r--hcid/dbus-adapter.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index efbb0ac0..272f6d35 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -2815,7 +2815,7 @@ static DBusHandlerResult adapter_set_trusted(DBusConnection *conn,
void *data)
{
struct adapter *adapter = data;
- DBusMessage *reply;
+ DBusMessage *reply, *signal;
bdaddr_t local;
const char *address;
@@ -2835,6 +2835,11 @@ static DBusHandlerResult adapter_set_trusted(DBusConnection *conn,
write_trust(&local, address, GLOBAL_TRUST, TRUE);
+ signal = dev_signal_factory(adapter->dev_id, "TrustAdded",
+ DBUS_TYPE_STRING, &address,
+ DBUS_TYPE_INVALID);
+ send_message_and_unref(conn, signal);
+
return send_message_and_unref(conn, reply);
}
@@ -2876,7 +2881,7 @@ static DBusHandlerResult adapter_remove_trust(DBusConnection *conn,
void *data)
{
struct adapter *adapter = data;
- DBusMessage *reply;
+ DBusMessage *reply, *signal;
const char *address;
bdaddr_t local;
@@ -2888,13 +2893,18 @@ static DBusHandlerResult adapter_remove_trust(DBusConnection *conn,
if (check_address(address) < 0)
return error_invalid_arguments(conn, msg);
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
str2ba(adapter->address, &local);
write_trust(&local, address, GLOBAL_TRUST, FALSE);
- reply = dbus_message_new_method_return(msg);
- if (!reply)
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ signal = dev_signal_factory(adapter->dev_id, "TrustRemoved",
+ DBUS_TYPE_STRING, &address,
+ DBUS_TYPE_INVALID);
+ send_message_and_unref(conn, signal);
return send_message_and_unref(conn, reply);
}