Merge pull request #413 from ogatatsu/fix_discovery
Fix discover characteristic.
This commit is contained in:
3 files changed
+14
-9
No files matched your search
@@ -155,6 +155,8 @@ bool BLEClientCharacteristic::_discoverDescriptor(uint16_t conn_handle, ble_gatt
|
||||
{
|
||||
LOG_LV2("DISC", "Found CCDD: handle = %d", disc_rsp.descs[i].handle);
|
||||
_cccd_handle = disc_rsp.descs[i].handle;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,9 @@ uint8_t BLEDiscovery::discoverCharacteristic(uint16_t conn_handle, BLEClientChar
|
||||
{
|
||||
for (uint8_t i=0; i<count; i++)
|
||||
{
|
||||
if ( chr[i]->discovered() )
|
||||
continue;
|
||||
|
||||
if ( chr[i]->uuid == disc_chr->chars[d].uuid )
|
||||
{
|
||||
LOG_LV2("DISC", "[CHR] Found 0x%04X, handle = %d\n-----------------", disc_chr->chars[d].uuid.uuid, disc_chr->chars[d].handle_value);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user