Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] android/gatt: Fix not sending confirmation while receiving indication
@ 2014-04-09  9:22 Marcin Kraglak
  2014-04-10  9:29 ` Szymon Janc
  0 siblings, 1 reply; 2+ messages in thread
From: Marcin Kraglak @ 2014-04-09  9:22 UTC (permalink / raw)
  To: linux-bluetooth

Send confirmation after receiving indication.
---
 android/gatt.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/android/gatt.c b/android/gatt.c
index a33ce25..a4c5026 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -2355,6 +2355,18 @@ static void handle_notification(const uint8_t *pdu, uint16_t len,
 	ev->len = len - data_offset;
 	memcpy(ev->value, pdu + data_offset, len - data_offset);
 
+	if (!ev->is_notify) {
+		uint8_t *res;
+		uint16_t len;
+		size_t plen;
+
+		res = g_attrib_get_buffer(notification->dev->attrib, &plen);
+		len = enc_confirmation(res, plen);
+		if (len > 0)
+			g_attrib_send(notification->dev->attrib, 0, res, len,
+							NULL, NULL, NULL);
+	}
+
 	ipc_send_notif(hal_ipc, HAL_SERVICE_ID_GATT, HAL_EV_GATT_CLIENT_NOTIFY,
 						sizeof(*ev) + ev->len, ev);
 }
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] android/gatt: Fix not sending confirmation while receiving indication
  2014-04-09  9:22 [PATCH] android/gatt: Fix not sending confirmation while receiving indication Marcin Kraglak
@ 2014-04-10  9:29 ` Szymon Janc
  0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-04-10  9:29 UTC (permalink / raw)
  To: Marcin Kraglak; +Cc: linux-bluetooth

Hi Marcin,

On Wednesday 09 of April 2014 11:22:40 Marcin Kraglak wrote:
> Send confirmation after receiving indication.
> ---
>  android/gatt.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index a33ce25..a4c5026 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -2355,6 +2355,18 @@ static void handle_notification(const uint8_t *pdu, uint16_t len,
>  	ev->len = len - data_offset;
>  	memcpy(ev->value, pdu + data_offset, len - data_offset);
>  
> +	if (!ev->is_notify) {
> +		uint8_t *res;
> +		uint16_t len;
> +		size_t plen;
> +
> +		res = g_attrib_get_buffer(notification->dev->attrib, &plen);
> +		len = enc_confirmation(res, plen);
> +		if (len > 0)
> +			g_attrib_send(notification->dev->attrib, 0, res, len,
> +							NULL, NULL, NULL);
> +	}
> +
>  	ipc_send_notif(hal_ipc, HAL_SERVICE_ID_GATT, HAL_EV_GATT_CLIENT_NOTIFY,
>  						sizeof(*ev) + ev->len, ev);
>  }
> 

Applied. Thanks.

-- 
Best regards, 
Szymon Janc

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-10  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-09  9:22 [PATCH] android/gatt: Fix not sending confirmation while receiving indication Marcin Kraglak
2014-04-10  9:29 ` Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox