add ClientCharacteristic disconnect()

This commit is contained in:
hathach committed 2017-07-18 21:00:58 +07:00
1 parent 32767269c1
commit f56c0dc458
4 files changed
+19 -3

No files matched your search

+9 -1
View File
@@ -103,7 +103,7 @@ void BLEGatt::_eventHandler(ble_evt_t* evt)
}
}
// disconnect Client Service of the disconnected handle
// disconnect Client Services & Characteristics of the disconnected handle
if ( evt->header.evt_id == BLE_GAP_EVT_DISCONNECTED )
{
for(int i=0; i<_client.svc_count; i++)
@@ -113,6 +113,14 @@ void BLEGatt::_eventHandler(ble_evt_t* evt)
_client.svc_list[i]->disconnect();
}
}
for(int i=0; i<_client.chr_count; i++)
{
if ( evt_conn_hdl == _client.chr_list[i]->_conn_hdl )
{
_client.chr_list[i]->disconnect();
}
}
}
// GATTC Read Characteristic by UUID procedure