From 6f1acc4b3d888572eab629a4f0ef56da4e8cda59 Mon Sep 17 00:00:00 2001 From: ogatatsu Date: Sun, 12 Jan 2020 20:16:35 +0900 Subject: [PATCH] Fixed a bug that disconnect function of client characteristics was not called. --- libraries/Bluefruit52Lib/src/BLEGatt.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libraries/Bluefruit52Lib/src/BLEGatt.cpp b/libraries/Bluefruit52Lib/src/BLEGatt.cpp index 55101f3b..35d7bef3 100644 --- a/libraries/Bluefruit52Lib/src/BLEGatt.cpp +++ b/libraries/Bluefruit52Lib/src/BLEGatt.cpp @@ -184,15 +184,6 @@ void BLEGatt::_eventHandler(ble_evt_t* evt) if ( evt_id == BLE_GAP_EVT_DISCONNECTED ) { // Client - for(uint8_t i=0; i<_client.svc_count; i++) - { - if ( evt_conn_hdl == _client.svc_list[i]->_conn_hdl) - { - _client.svc_list[i]->disconnect(); - } - } - - // TODO merge to above loop for(uint8_t i=0; i<_client.chr_count; i++) { if ( evt_conn_hdl == _client.chr_list[i]->connHandle() ) @@ -200,6 +191,15 @@ void BLEGatt::_eventHandler(ble_evt_t* evt) _client.chr_list[i]->disconnect(); } } + + // TODO merge to above loop + for(uint8_t i=0; i<_client.svc_count; i++) + { + if ( evt_conn_hdl == _client.svc_list[i]->_conn_hdl) + { + _client.svc_list[i]->disconnect(); + } + } } // GATTC Read Characteristic by UUID procedure