From 17ac2d59b87d079577ae062e49a581085431bb56 Mon Sep 17 00:00:00 2001 From: Marcin Kraglak Date: Wed, 9 Apr 2014 11:22:40 +0200 Subject: [PATCH] android/gatt: Fix not sending confirmation while receiving indication 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 971e2ddd9..d16f57649 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); } -- 2.47.3