From a42e4f694fbe1c56dd601e507949751b3a8ca73f Mon Sep 17 00:00:00 2001 From: Jonathan Gelie Date: Mon, 6 Feb 2017 14:43:08 +0100 Subject: [PATCH] Bluetooth: GATT: set subscribe value to zero for unsubscription Subscribe value is set to zero before calling notify callback, to distinguish a subscription failure from an unsubscription on disconnection (when flag BT_GATT_SUBSCRIBE_FLAG_VOLATILE is set). Change-Id: Ia91220492d82041b2c385bf88a15180387e7a483 Signed-off-by: Jonathan Gelie --- drivers/bluetooth/nble/gatt.c | 1 + subsys/bluetooth/host/gatt.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/bluetooth/nble/gatt.c b/drivers/bluetooth/nble/gatt.c index 63bc8444441..c06898ab299 100644 --- a/drivers/bluetooth/nble/gatt.c +++ b/drivers/bluetooth/nble/gatt.c @@ -1220,6 +1220,7 @@ static void remove_subscriptions(struct bt_conn *conn) if (params->flags & BT_GATT_SUBSCRIBE_FLAG_VOLATILE) { /* Remove subscription */ + params->value = 0; gatt_subscription_remove(conn, prev, params); } } diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index c6b75d5fa50..58c909d0521 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -761,6 +761,7 @@ static void remove_subscriptions(struct bt_conn *conn) if (!bt_addr_le_is_bonded(&conn->le.dst) || (params->flags & BT_GATT_SUBSCRIBE_FLAG_VOLATILE)) { /* Remove subscription */ + params->value = 0; gatt_subscription_remove(conn, prev, params); } else { update_subscription(conn, params);