Fixed a bug that disconnect function of client characteristics was not called.

This commit is contained in:
ogatatsu committed 2020-01-12 20:16:35 +09:00
1 parent 37e3b53bcf
commit 6f1acc4b3d
1 file changed
+9 -9
+9 -9
View File
@@ -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