add indicate API, add getCccd to BLECharacteristic

This commit is contained in:
hathach committed 2018-01-17 21:43:57 +07:00
1 parent a70d157656
commit 20a2db556c
4 files changed
+137 -7

No files matched your search

+25
View File
@@ -49,6 +49,12 @@ uint16_t BLEGatt::readCharByUuid(uint16_t conn_hdl, BLEUuid bleuuid, void* buffe
int32_t count = 0;
ble_gattc_handle_range_t hdl_range = { .start_handle = start_hdl, .end_handle = end_hdl };
while( _adamsg.isWaiting() )
{
// TODO multiple peripherals
delay( Bluefruit.connInterval() );
}
_adamsg.begin(true);
_adamsg.prepare(buffer, bufsize);
@@ -68,6 +74,25 @@ uint16_t BLEGatt::readCharByUuid(uint16_t conn_hdl, BLEUuid bleuuid, void* buffe
return (count < 0) ? 0 : count;
}
//bool BLEGatt::waitForIndicateConfirm(uint16_t conn_hdl)
//{
// while( _adamsg.isWaiting() )
// {
// // TODO multiple peripherals
// delay( Bluefruit.connInterval() );
// }
//
// _adamsg.begin(true);
// _adamsg.prepare(NULL, 0);
//
// // Wait for HVC event
// int32_t result = _adamsg.waitUntilComplete(BLE_GENERIC_TIMEOUT);
//
// _adamsg.stop();
//
// return (result == 0);
//}
void BLEGatt::_eventHandler(ble_evt_t* evt)
{
// conn handle has fixed offset regardless of event type