Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] android/gatt: Fix not confirming notifications and indications
Date: Wed, 11 Feb 2015 12:35:04 +0100	[thread overview]
Message-ID: <1632447.OVzGjUrTBX@uw000953> (raw)
In-Reply-To: <1423562671-24467-1-git-send-email-jakub.tyszkowski@tieto.com>

Hi Jakub,

On Tuesday 10 of February 2015 11:04:31 Jakub Tyszkowski wrote:
> In Lollipop, server app notifications needs to be confirmed just like
> indications. We had those confirmations missing thus server apps
> would stop indicating/notifying after first indication/notification
> is send.
> ---
>  android/gatt.c | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index a36922c..4398194 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -5532,6 +5532,18 @@ failed:
>  				HAL_OP_GATT_SERVER_DELETE_SERVICE, status);
>  }
>  
> +static void indication_confirmation_cb(guint8 status, const guint8 *pdu,
> +						guint16 len, gpointer user_data)
> +{
> +	struct hal_ev_gatt_server_indication_sent ev;
> +
> +	ev.status = status;
> +	ev.conn_id = PTR_TO_UINT(user_data);
> +
> +	ipc_send_notif(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_EV_GATT_SERVER_INDICATION_SENT, sizeof(ev), &ev);
> +}
> +
>  static void handle_server_send_indication(const void *buf, uint16_t len)
>  {
>  	const struct hal_cmd_gatt_server_send_indication *cmd = buf;
> @@ -5554,11 +5566,10 @@ static void handle_server_send_indication(const void *buf, uint16_t len)
>  	pdu = g_attrib_get_buffer(conn->device->attrib, &mtu);
>  
>  	if (cmd->confirm) {
> -		/* TODO: Add data to track confirmation for this request */
>  		length = enc_indication(cmd->attribute_handle,
>  					(uint8_t *) cmd->value, cmd->len, pdu,
>  					mtu);
> -		confirmation_cb = ignore_confirmation_cb;
> +		confirmation_cb = indication_confirmation_cb;
>  	} else {
>  		length = enc_notification(cmd->attribute_handle,
>  						(uint8_t *) cmd->value,
> @@ -5570,10 +5581,15 @@ static void handle_server_send_indication(const void *buf, uint16_t len)
>  		status = HAL_STATUS_FAILED;
>  	} else {
>  		g_attrib_send(conn->device->attrib, 0, pdu, length,
> -						confirmation_cb, NULL, NULL);
> +				confirmation_cb, UINT_TO_PTR(conn->id), NULL);
>  		status = HAL_STATUS_SUCCESS;
>  	}
>  
> +	/* Here we confirm failed indications and all notifications */
> +	if (status || !confirmation_cb)
> +		indication_confirmation_cb(status, NULL, 0,
> +							UINT_TO_PTR(conn->id));
> +
>  reply:
>  	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
>  				HAL_OP_GATT_SERVER_SEND_INDICATION, status);
> 

Applied, thanks.

-- 
Best regards, 
Szymon Janc

      reply	other threads:[~2015-02-11 11:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10 10:04 [PATCH] android/gatt: Fix not confirming notifications and indications Jakub Tyszkowski
2015-02-11 11:35 ` Szymon Janc [this message]

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=1632447.OVzGjUrTBX@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=jakub.tyszkowski@tieto.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