From: Szymon Janc <szymon.janc@tieto.com>
To: Johan Hedberg <johan.hedberg@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH v3 07/18] neard: Implement PushOOB function
Date: Mon, 24 Sep 2012 16:38:18 +0200 [thread overview]
Message-ID: <2284652.s6rmWXqmaz@uw000953> (raw)
In-Reply-To: <20120924090941.GA20042@x220>
On Monday 24 of September 2012 12:09:41 Johan Hedberg wrote:
> Hi Szymon,
Hi Johan,
> On Fri, Sep 21, 2012, Szymon Janc wrote:
> > +static struct btd_adapter *pending_adapter = NULL;
> > +static DBusMessage *pending_msg = NULL;
>
> I'm not really a fan of these global variables. Any chance of moving
> them to a non-global temporary context that gets passed around.
The idea is to keep this plugin simple so only one request at time is to be
supported. mgmt code doesn't allow to pass any 'key-like' data to identify
command<->event so this would require some general (?) solution.
I don't think this is needed.
Actually, pending_adapter might not be needed if it is guaranteed that default
adapter will not change before callback is called (I guess it is).
> In
> general I find it hard to get the big picture on the life-time of these
> variables as it seems you don't actually explicitly initiate the pairing
> process from your code but are relying on some external entity to do
> that? Or did I miss something? The whole thing just looks quite brittle
> right now.
pending_* pointers are used to store data until read local or pairing callback
is called. Pairing is initiate in PushOOB method (adapter_create_bonding is
called from process_eir).
But yeah, I guess I should have been more descriptive in cover letter. So here
is few words of overview.
Currently handover agent API consists of 2 methods RequestOOB and PushOOB.
PushOOB is used to provide data and start pairing if needed to prepare
alternative carrier (BT). From NFC side this corresponds to receiving Handover
Select frame.
RequestOOB is used to request local data from BT to pass them to remote. This
method also allows to pass remote oob data without triggering pairing (to be
used when remote starts it) - this will minimize number of D-Bus calls
needed. From NFC side this corresponds to receiving (pass remote data and
request local data) or sending (only request local data) Handover Request
frame.
Basically there are 3 possible scenarios:
- neard received Handover Select message (aka static handover):
neard calls PushOOB(data)
bluez pairs if needed and reply
- neard received Handover Request and needs to reply with Handover Select:
neard calls RequestOOB(data) and pass remote oob data received
bluez stores received data, reads local OOB data and reply to neard
neard sends HS frame based on bluez reply
[in that case remote is responsible to initialize pairing if needed]
- neard sends Handover Request and later receives Handover Select from remote:
neard calls RequestOOB(NULL)
bluez reads local OOB data and reply to neard
neard sends Handover Request base on bluez reply
neard receives Handover Select frame
neard calls PushOOB(data)
bluez pairs if needed and reply
Hope this clarify things a bit:)
> Johan
--
BR
Szymon Janc
next prev parent reply other threads:[~2012-09-24 14:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-21 12:36 [PATCH v3 00/18] neard plugin Szymon Janc
2012-09-21 12:36 ` [PATCH v3 01/18] Add initial neard plugin implementation Szymon Janc
2012-09-21 12:36 ` [PATCH v3 02/18] eir: Add support for parsing SSP hash and randomizer Szymon Janc
2012-09-24 8:08 ` Johan Hedberg
2012-09-24 10:20 ` Szymon Janc
2012-09-21 12:36 ` [PATCH v3 03/18] eir: Store class in struct eir_data as uint32_t Szymon Janc
2012-09-21 12:36 ` [PATCH v3 04/18] eir: Add eir_parse_oob function Szymon Janc
2012-09-21 12:36 ` [PATCH v3 05/18] oob: Allow to register pairing complete callback Szymon Janc
2012-09-24 9:06 ` Johan Hedberg
2012-09-24 11:28 ` Szymon Janc
2012-09-21 12:36 ` [PATCH v3 06/18] Handle missing randomizer in mgmt_add_remote_oob_data Szymon Janc
2012-09-21 12:36 ` [PATCH v3 07/18] neard: Implement PushOOB function Szymon Janc
2012-09-24 9:09 ` Johan Hedberg
2012-09-24 14:38 ` Szymon Janc [this message]
2012-09-21 12:36 ` [PATCH v3 08/18] eir: Add support creating EIR with hash and randomizer fields Szymon Janc
2012-09-21 12:36 ` [PATCH v3 09/18] eir: Add support for creating EIR with CoD field Szymon Janc
2012-09-21 12:36 ` [PATCH v3 10/18] eir: Rename eir_create to eir_create_oob Szymon Janc
2012-09-21 12:36 ` [PATCH v3 11/18] eir: Remove support for creating EIR with tx_power fields Szymon Janc
2012-09-21 12:36 ` [PATCH v3 12/18] eir: Return number of bytes written by eir_create_oob Szymon Janc
2012-09-21 12:36 ` [PATCH v3 13/18] eir: Remove struct uuid_info Szymon Janc
2012-09-21 12:36 ` [PATCH v3 14/18] eir: Add support for creating proper OOB EIR Szymon Janc
2012-09-21 12:36 ` [PATCH v3 15/18] adapter: Add btd_adapter_get_services function Szymon Janc
2012-09-21 12:36 ` [PATCH v3 16/18] adapter: Rename btd_adapter_get_class to btd_adapter_read_class Szymon Janc
2012-09-21 12:36 ` [PATCH v3 17/18] adapter: Add btd_adapter_get_class function Szymon Janc
2012-09-21 12:36 ` [PATCH v3 18/18] neard: Implement RequestOOB function Szymon Janc
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=2284652.s6rmWXqmaz@uw000953 \
--to=szymon.janc@tieto.com \
--cc=johan.hedberg@gmail.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