summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-10-15 15:02:30 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2012-10-15 15:02:30 +0300
commit28c1a744528ca9ce321960088eb18a6bc989a754 (patch)
treec70041f84e7893e1c3117a616dfd4d0aa1046892 /src
parent582eafacfe8929db9621ae409ed84da1b35b9f7d (diff)
device: Implement Device.CancelPairing method
Diffstat (limited to 'src')
-rw-r--r--src/device.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/device.c b/src/device.c
index 7e940a17..b0d43b4d 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1376,6 +1376,22 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg,
return device_create_bonding(device, msg, agent_path, io_cap);
}
+static DBusMessage *cancel_pairing(DBusConnection *conn, DBusMessage *msg,
+ void *data)
+{
+ struct btd_device *device = data;
+ struct bonding_req *req = device->bonding;
+
+ DBG("");
+
+ if (!req)
+ return btd_error_does_not_exist(msg);
+
+ device_cancel_bonding(device, MGMT_STATUS_CANCELLED);
+
+ return dbus_message_new_method_return(msg);
+}
+
static const GDBusMethodTable device_methods[] = {
{ GDBUS_ASYNC_METHOD("DiscoverServices",
GDBUS_ARGS({ "pattern", "s" }),
@@ -1387,6 +1403,7 @@ static const GDBusMethodTable device_methods[] = {
{ GDBUS_ASYNC_METHOD("Pair",
GDBUS_ARGS({ "agent", "o" }, { "capability", "s" }),
NULL, pair_device) },
+ { GDBUS_METHOD("CancelPairing", NULL, NULL, cancel_pairing) },
{ }
};