From: Szymon Janc <szymon.janc@codecoup.pl>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@codecoup.pl>
Subject: [RFC 5/5] client: Add support for RebondConsent request
Date: Thu, 4 Aug 2016 15:28:39 +0200 [thread overview]
Message-ID: <1470317319-3985-6-git-send-email-szymon.janc@codecoup.pl> (raw)
In-Reply-To: <1470317319-3985-1-git-send-email-szymon.janc@codecoup.pl>
This allows to accept or reject rebond consent from bluetoothd.
---
client/agent.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/client/agent.c b/client/agent.c
index 2cbc292..e4b1f01 100644
--- a/client/agent.c
+++ b/client/agent.c
@@ -144,6 +144,8 @@ dbus_bool_t agent_input(DBusConnection *conn, const char *input)
confirm_response(conn, input);
else if (!strcmp(member, "AuthorizeService"))
confirm_response(conn, input);
+ else if (!strcmp(member, "RebondConsent"))
+ confirm_response(conn, input);
else
g_dbus_send_error(conn, pending_message,
"org.bluez.Error.Canceled", NULL);
@@ -310,6 +312,23 @@ static DBusMessage *authorize_service(DBusConnection *conn,
return NULL;
}
+static DBusMessage *rebond_consent(DBusConnection *conn,
+ DBusMessage *msg, void *user_data)
+{
+ const char *device;
+
+ rl_printf("Rebond Consent\n");
+
+ dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &device,
+ DBUS_TYPE_INVALID);
+
+ agent_prompt("Remote Device lost bond. Rebond (yes/no): ");
+
+ pending_message = dbus_message_ref(msg);
+
+ return NULL;
+}
+
static DBusMessage *cancel_request(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
@@ -346,6 +365,9 @@ static const GDBusMethodTable methods[] = {
{ GDBUS_ASYNC_METHOD("AuthorizeService",
GDBUS_ARGS({ "device", "o" }, { "uuid", "s" }),
NULL, authorize_service) },
+ { GDBUS_ASYNC_METHOD("RebondConsent",
+ GDBUS_ARGS({ "device", "o" }),
+ NULL, rebond_consent) },
{ GDBUS_METHOD("Cancel", NULL, NULL, cancel_request) },
{ }
};
--
2.7.4
prev parent reply other threads:[~2016-08-04 13:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 13:28 [RFC 0/5] Rebond support Szymon Janc
2016-08-04 13:28 ` [RFC 1/5] lib/mgmt: Add MGMT_DEV_DISCONN_AUTH_FAILURE definition Szymon Janc
2016-08-04 13:28 ` [RFC 2/5] doc: Add RebondConsent method to agent API Szymon Janc
2016-08-04 13:28 ` [RFC 3/5] core/adapter: Add support for rebond consent Szymon Janc
2016-08-04 13:28 ` [RFC 4/5] plugins/policy: Disable policies on authentication failure Szymon Janc
2016-08-04 13:28 ` Szymon Janc [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470317319-3985-6-git-send-email-szymon.janc@codecoup.pl \
--to=szymon.janc@codecoup.pl \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).