From: Marcel Holtmann <marcel@holtmann.org>
To: Arman Uguray <armansito@chromium.org>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
"linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH BlueZ 3/8] shared/gatt-client: Store services in gatt_db.
Date: Mon, 1 Dec 2014 18:19:51 +0100 [thread overview]
Message-ID: <ADB9F0AE-DABA-4530-8133-20437111A716@holtmann.org> (raw)
In-Reply-To: <CAHrH25Q3ZYB6PKoStwcG_gUSgR2BJHqt1_Wvf0ZPrK3NQ7mZrw@mail.gmail.com>
Hi Arman,
>>>>> This patch rewrites the service discovery logic inside
>>>>> shared/gatt-client. The internal service_list structure has been
>>>>> entirely removed and services are stored in a gatt_db instance.
>>>>> Initially, gatt-client creates and owns the life-time of the gatt_db.
>>>>
>>>> Im trying to figure out the reason why you want to start with your own
>>>> gatt_db, is it because it lacks reference counting, if that is the
>>>> case it should be trivial to add it.
>>>>
>>>
>>> Initially, yes, the lack of reference counting is one reason, which I
>>> was thinking of adding to gatt-db eventually. Though, what I had in
>>> mind was that, the gatt-db would be created by gatt-client if you want
>>> it to perform discovery, otherwise if you construct it with gatt-db
>>> then it wouldn't do discovery, which would address the permanent cache
>>> case. So, we would have two "new" functions:
>>>
>>> bt_gatt_client_new
>>> bt_gatt_client_new_from_db
>>>
>>> In the first case, if the upper layer wants to make the gatt-db
>>> outlive the gatt-client, in the future they can just add a reference
>>> to it and own it and in the next connection they can create the client
>>> using that same db instance. This is kind of a rough idea right now
>>> but I think it makes sense.
>>>
>>> We can also keep both functions but have both accept a gatt-db as a
>>> parameter. Not sure what's best here really.
>>
>> For unit test maybe we can have bt_gatt_client_new_default, iirc
>> Marcel suggested something like this for naming, but for the core
>> daemon it can create a empty db when pairing so even the initial
>> discovery would use it. This comes back to the idea of having the
>> callbacks in the db to attribute added/removed, with this logic we
>> could start creating D-Bus objects by the time a services is
>> discovered (provided we discover everything necessary) and not only
>> when bt_gatt_client signals it is done discovering, actually with the
>> current concept we could be spamming the bus a little too much since
>> the objects would be created all at same time this would cause several
>> InterfacesAdded signals in a row at the end of pairing.
>>
>
> I don't know about "_default" naming but are we talking about something like:
>
> bt_gatt_client_new(att, mtu, db) /* Does discovery */
> bt_gatt_client_new_from_cache(att, mtu, db) /* No discovery */
>
> So both functions get passed a db either way?
actually we might just better only use bt_gatt_client_new() and provide functionality to flush certain devices from the cache. In case we do want to trigger a discovery or re-discovery of devices.
The cache should just work and do the right thing. We should be able set max cacheable service, devices etc. So lets just give the GATT client a cache to work with and that is it. Everything else is an implementation detail between the client and the cache.
I prefer that every client has a cache attached to it (or allow NULL in case we really want to run without a cache). If the cache is independent, it can easily do the right thing for us.
Regards
Marcel
next prev parent reply other threads:[~2014-12-01 17:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-28 17:49 [PATCH BlueZ 0/8] shared/gatt: Use gatt-db for client role Arman Uguray
2014-11-28 17:49 ` [PATCH BlueZ 1/8] shared/gatt-db: Fix bug in maximum handle check Arman Uguray
2014-11-28 17:49 ` [PATCH BlueZ 2/8] shared/gatt-db: Add helper to get service handles Arman Uguray
2014-11-28 17:49 ` [PATCH BlueZ 3/8] shared/gatt-client: Store services in gatt_db Arman Uguray
2014-12-01 9:45 ` Luiz Augusto von Dentz
2014-12-01 14:50 ` Arman Uguray
2014-12-01 16:02 ` Luiz Augusto von Dentz
2014-12-01 16:37 ` Arman Uguray
2014-12-01 17:19 ` Marcel Holtmann [this message]
2014-12-01 17:57 ` Arman Uguray
2014-12-02 10:46 ` Luiz Augusto von Dentz
2014-12-02 15:12 ` Luiz Augusto von Dentz
2014-12-02 19:35 ` Arman Uguray
2014-12-03 0:15 ` Arman Uguray
2014-11-28 17:49 ` [PATCH BlueZ 4/8] shared/gatt-client: Use gatt_db in bt_gatt_register_notify Arman Uguray
2014-11-28 17:49 ` [PATCH BlueZ 5/8] tools/btgatt-server: Add the "services" command Arman Uguray
2014-11-28 17:49 ` [PATCH BlueZ 6/8] tools/btgatt-client: Use gatt-db instead of iterators Arman Uguray
2014-11-28 17:49 ` [PATCH BlueZ 7/8] unit/test-gatt: Use gatt-db for CLIENT tests Arman Uguray
2014-11-28 17:49 ` [PATCH BlueZ 8/8] shared/gatt-client: Remove GATT structs and iterators Arman Uguray
2014-12-01 9:49 ` [PATCH BlueZ 0/8] shared/gatt: Use gatt-db for client role Luiz Augusto von Dentz
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=ADB9F0AE-DABA-4530-8133-20437111A716@holtmann.org \
--to=marcel@holtmann.org \
--cc=armansito@chromium.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
/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