mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 05:00:55 +01:00
Fix notifications not being sent.
The connection handle was not initialized correctly when recording the subscibe status causing the call to send notification/indications to fail with BLE_HS_ENOTCONN.
This commit is contained in:
parent
73f0277042
commit
5b24c8d681
1 changed files with 8 additions and 10 deletions
|
@ -554,18 +554,16 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
|
||||||
|
|
||||||
for(auto &it : pServer->m_notifyChrVec) {
|
for(auto &it : pServer->m_notifyChrVec) {
|
||||||
if(it->getHandle() == event->subscribe.attr_handle) {
|
if(it->getHandle() == event->subscribe.attr_handle) {
|
||||||
if((it->getProperties() & BLE_GATT_CHR_F_READ_AUTHEN) ||
|
rc = ble_gap_conn_find(event->subscribe.conn_handle, &peerInfo.m_desc);
|
||||||
(it->getProperties() & BLE_GATT_CHR_F_READ_AUTHOR) ||
|
if (rc != 0) {
|
||||||
(it->getProperties() & BLE_GATT_CHR_F_READ_ENC))
|
break;
|
||||||
{
|
}
|
||||||
rc = ble_gap_conn_find(event->subscribe.conn_handle, &peerInfo.m_desc);
|
|
||||||
if (rc != 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!peerInfo.isEncrypted()) {
|
if(((it->getProperties() & BLE_GATT_CHR_F_READ_AUTHEN) ||
|
||||||
|
(it->getProperties() & BLE_GATT_CHR_F_READ_AUTHOR) ||
|
||||||
|
(it->getProperties() & BLE_GATT_CHR_F_READ_ENC)) &&
|
||||||
|
!peerInfo.isEncrypted()) {
|
||||||
NimBLEDevice::startSecurity(event->subscribe.conn_handle);
|
NimBLEDevice::startSecurity(event->subscribe.conn_handle);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it->setSubscribe(event, peerInfo);
|
it->setSubscribe(event, peerInfo);
|
||||||
|
|
Loading…
Reference in a new issue