From: Johan Hedberg <johan.hedberg@gmail.com>
To: Bartosz Szatkowski <bulislaw@linux.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/3] Add SetRemoteProperties method for OOB COD setting
Date: Mon, 22 Aug 2011 10:22:28 +0300 [thread overview]
Message-ID: <20110822072228.GA31063@dell> (raw)
In-Reply-To: <1313133349-4215-1-git-send-email-bulislaw@linux.com>
Hi Bartosz,
On Fri, Aug 12, 2011, Bartosz Szatkowski wrote:
> +struct oob_remote_parameters {
> + bdaddr_t local;
> + bdaddr_t peer;
> + const char *address;
> + uint32_t class;
> +};
Could you add a "gboolean device_found;" to this struct and then use it
as follows:
> +static DBusMessage *parse_class(DBusMessageIter *value,
> + struct oob_remote_parameters *params, DBusMessage *msg)
> +{
> + if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_UINT32)
> + return btd_error_invalid_args(msg);
> +
> + dbus_message_iter_get_basic(value, ¶ms->class);
params->device_found = TRUE;
> + return NULL;
> +}
> +
> +static gboolean set_class(struct oob_remote_parameters *params)
> +{
> + if (params->class == 0)
> + return FALSE;
You can move the above if-statement here:
> +static void set_properties(struct btd_adapter *adapter,
> + struct oob_remote_parameters *params)
> +{
> + gboolean device_found = FALSE;
> +
> + if (set_class(params))
> + device_found = TRUE;
I.e. change this to:
if (params->class != 0)
write_remote_class(...);
I suppose you could keep the set_class function if you want, but since
all it does is make a single write_remote_class call you might as well
do the call directly as above.
> + if (device_found)
> + emit_device_found(adapter_get_path(adapter), params);
> +}
The above would become:
if (params->device_found)
emit_device_found(..., params);
With these changes the flow of logic becomes a bit easier to follow (to
me at least).
Johan
next prev parent reply other threads:[~2011-08-22 7:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-11 11:14 [PATCH BlueZ 1/3] Add SetRemoteProperties method for OOB COD setting Bartosz Szatkowski
2011-08-11 11:14 ` [PATCH BlueZ 2/3] Add support for OOB data in SetRemoteProperties Bartosz Szatkowski
2011-08-11 11:14 ` [PATCH BlueZ 3/3] Add support for name in OOB SetRemoteProperties Bartosz Szatkowski
2011-08-11 16:51 ` [PATCH BlueZ 1/3] Add SetRemoteProperties method for OOB COD setting Vinicius Costa Gomes
2011-08-11 19:16 ` Bartosz Szatkowski
2011-08-12 7:15 ` [PATCH " Bartosz Szatkowski
2011-08-22 7:22 ` Johan Hedberg [this message]
2011-08-22 8:12 ` Bartosz Szatkowski
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=20110822072228.GA31063@dell \
--to=johan.hedberg@gmail.com \
--cc=bulislaw@linux.com \
--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).