From 82974778682d0a616a2cbfe1b27f53a60c70a38c Mon Sep 17 00:00:00 2001 From: David Sanders Date: Sun, 10 Sep 2017 06:54:00 -0600 Subject: [PATCH] Fix indication deadlock --- src/nRF51822.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/nRF51822.cpp b/src/nRF51822.cpp index 21adf73..1380ba8 100644 --- a/src/nRF51822.cpp +++ b/src/nRF51822.cpp @@ -1082,15 +1082,9 @@ bool nRF51822::updateCharacteristicValue(BLECharacteristic& characteristic) { } if (localCharacteristicInfo->indicateSubscribed) { - if (this->_txBufferCount > 0) { - this->_txBufferCount--; + hvxParams.type = BLE_GATT_HVX_INDICATION; - hvxParams.type = BLE_GATT_HVX_INDICATION; - - sd_ble_gatts_hvx(this->_connectionHandle, &hvxParams); - } else { - success = false; - } + success = sd_ble_gatts_hvx(this->_connectionHandle, &hvxParams) == NRF_SUCCESS; } } } @@ -1141,7 +1135,7 @@ bool nRF51822::canNotifyCharacteristic(BLECharacteristic& /*characteristic*/) { } bool nRF51822::canIndicateCharacteristic(BLECharacteristic& /*characteristic*/) { - return (this->_txBufferCount > 0); + return true; } bool nRF51822::canReadRemoteCharacteristic(BLERemoteCharacteristic& characteristic) {