Linux bluetooth development
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
To: Alex Deymo <deymo@chromium.org>
Cc: linux-bluetooth@vger.kernel.org, keybuk@chromium.org,
	marcel@holtmann.org
Subject: Re: [PATCH 5/6] Agent's DisplayPasskey implementation
Date: Thu, 14 Mar 2013 16:51:32 -0300	[thread overview]
Message-ID: <20130314195132.GD2649@samus> (raw)
In-Reply-To: <1363285326-20089-6-git-send-email-deymo@chromium.org>

Hi Alex,


On 11:22 Thu 14 Mar, Alex Deymo wrote:
> Implements the DisplayPasskey(object device, uint32 passkey, uint16 entered)
> method.
> ---
>  client/agent.c   | 30 ++++++++++++++++++++++++++++++
>  client/display.h |  2 ++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/client/agent.c b/client/agent.c
> index 579ae4e..cb710da 100644
> --- a/client/agent.c
> +++ b/client/agent.c
> @@ -184,6 +184,32 @@ static DBusMessage *display_pincode(DBusConnection *conn,
>  	return dbus_message_new_method_return(msg);
>  }
>  
> +static DBusMessage *display_passkey(DBusConnection *conn,
> +					DBusMessage *msg, void *user_data)
> +{
> +	const char *device;
> +	dbus_uint32_t passkey;
> +	dbus_uint16_t entered;
> +	char passkey_entered[7];
> +	char passkey_remaining[7];
> +
> +	dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &device,
> +			DBUS_TYPE_UINT32, &passkey, DBUS_TYPE_UINT16, &entered,
> +							DBUS_TYPE_INVALID);
> +
> +	snprintf(passkey_entered, 7, "%.6u", passkey);
> +	passkey_entered[6] = '\0';
> +	strncpy(passkey_remaining, passkey_entered, 7);
> +	if (entered > strlen(passkey_entered))
> +		entered = strlen(passkey_entered);
> +	passkey_entered[entered] = '\0';

Some empty lines in this block please.

> +
> +	rl_printf(AGENT_PROMPT "Passkey: " COLOR_BOLDGRAY "%s" COLOR_BOLDWHITE
> +		"%s\n" COLOR_OFF, passkey_entered, passkey_remaining+entered);
> +
> +	return dbus_message_new_method_return(msg);
> +}
> +
>  static DBusMessage *request_confirmation(DBusConnection *conn,
>  					DBusMessage *msg, void *user_data)
>  {
> @@ -262,6 +288,10 @@ static const GDBusMethodTable methods[] = {
>  	{ GDBUS_METHOD("DisplayPinCode",
>  			GDBUS_ARGS({ "device", "o" }, { "pincode", "s" }),
>  			NULL, display_pincode) },
> +	{ GDBUS_METHOD("DisplayPasskey",
> +			GDBUS_ARGS({ "device", "o" }, { "passkey", "u" },
> +							{ "entered", "q" }),
> +			NULL, display_passkey) },
>  	{ GDBUS_ASYNC_METHOD("RequestConfirmation",
>  			GDBUS_ARGS({ "device", "o" }, { "passkey", "u" }),
>  			NULL, request_confirmation) },
> diff --git a/client/display.h b/client/display.h
> index 957bdc6..91a0be9 100644
> --- a/client/display.h
> +++ b/client/display.h
> @@ -26,5 +26,7 @@
>  #define COLOR_GREEN	"\x1B[0;92m"
>  #define COLOR_YELLOW	"\x1B[0;93m"
>  #define COLOR_BLUE	"\x1B[0;94m"
> +#define COLOR_BOLDGRAY	"\x1B[1;30m"
> +#define COLOR_BOLDWHITE	"\x1B[1;37m"
>  
>  void rl_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
> -- 
> 1.8.1.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Cheers,
-- 
Vinicius

  reply	other threads:[~2013-03-14 19:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 18:22 [PATCH 0/6] bluetoothctl: agent's implementation Alex Deymo
2013-03-14 18:22 ` [PATCH 1/6] Add color modifiers to NEW, CHG and DEL events Alex Deymo
2013-03-14 18:22 ` [PATCH 2/6] Right prompt management on agent input Alex Deymo
2013-03-14 19:32   ` Vinicius Costa Gomes
2013-03-14 23:26     ` Alex Deymo
2013-03-14 18:22 ` [PATCH 3/6] "agent" command capability argument and autocompletion Alex Deymo
2013-03-14 19:47   ` Vinicius Costa Gomes
2013-03-14 20:00   ` Vinicius Costa Gomes
2013-03-14 20:32     ` Alex Deymo
2013-03-14 20:41       ` Vinicius Costa Gomes
2013-03-14 22:08         ` Alex Deymo
2013-03-15  3:47           ` Alex Deymo
2013-03-14 18:22 ` [PATCH 4/6] Agent's DisplayPincode implementation Alex Deymo
2013-03-14 18:22 ` [PATCH 5/6] Agent's DisplayPasskey implementation Alex Deymo
2013-03-14 19:51   ` Vinicius Costa Gomes [this message]
2013-03-14 20:45   ` Anderson Lizardo
2013-03-14 18:22 ` [PATCH 6/6] Agent's RequestPasskey implementation Alex Deymo
2013-03-15  3:54   ` Alex Deymo
2013-03-15  3:52 ` [PATCH 5/6] Agent's DisplayPasskey implementation Alex Deymo

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=20130314195132.GD2649@samus \
    --to=vinicius.gomes@openbossa.org \
    --cc=deymo@chromium.org \
    --cc=keybuk@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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