Re: [PATCH BlueZ] gatt-client: allow AcquireNotify when characteristic has indicate flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Benedek,

On Thu, Aug 22, 2024 at 7:32 AM Benedek Kupper <kupper.benedek@xxxxxxxxx> wrote:
>
> From: Benedek Kupper <benedek.kupper@xxxxxxxxxxx>
>
> StartNotify / StopNotify already correctly allows usage when the
> characteristic indicate is present (simplify this check though),
> apply the same to AcquireNotify.
> ---
>  src/gatt-client.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/gatt-client.c b/src/gatt-client.c
> index 8d83a9577..a67e04eee 100644
> --- a/src/gatt-client.c
> +++ b/src/gatt-client.c
> @@ -1556,7 +1556,8 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
>         if (!queue_isempty(chrc->notify_clients))
>                 return btd_error_in_progress(msg);
>
> -       if (!(chrc->props & BT_GATT_CHRC_PROP_NOTIFY))
> +       if (!(chrc->props & (BT_GATT_CHRC_PROP_NOTIFY |
> +                       BT_GATT_CHRC_PROP_INDICATE)))
>                 return btd_error_not_supported(msg);
>
>         client = notify_client_create(chrc, sender);
> @@ -1601,8 +1602,8 @@ static DBusMessage *characteristic_start_notify(DBusConnection *conn,
>         if (chrc->notify_io)
>                 return btd_error_not_permitted(msg, "Notify acquired");
>
> -       if (!(chrc->props & BT_GATT_CHRC_PROP_NOTIFY ||
> -                               chrc->props & BT_GATT_CHRC_PROP_INDICATE))
> +       if (!(chrc->props & (BT_GATT_CHRC_PROP_NOTIFY |
> +                               BT_GATT_CHRC_PROP_INDICATE)))
>                 return btd_error_not_supported(msg);

Afaik this is working according to the documentation:

'Only works with characteristic that has NotifyAcquired property which
relies on "notify" Flag and no other client have called
StartNotify().'

https://github.com/bluez/bluez/blob/master/doc/org.bluez.GattCharacteristic.rst#fd-uint16-acquirenotifydict-options-optional[1]

So if we want it to work with Indication as well then we need to
change the documentation to reflect these changes, indication does
mean one need to confirm the reception which is something that would
require some work if done via fd, but in the other hand I think we are
auto confirming in case of D-Bus since that is using a D-Bus signals
so perhaps it would be fine to do the same with fd as well.

>         /* Each client can only have one active notify session. */
> --
> 2.34.1
>
>


-- 
Luiz Augusto von Dentz





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux