Fix issue with semaphores (#2974)
This commit is contained in:
parent
d5fdd715ef
commit
d1134fd45e
@ -184,10 +184,11 @@ void BLEClient::gattClientEventHandler(
|
|||||||
if (m_pClientCallbacks != nullptr) {
|
if (m_pClientCallbacks != nullptr) {
|
||||||
m_pClientCallbacks->onDisconnect(this);
|
m_pClientCallbacks->onDisconnect(this);
|
||||||
}
|
}
|
||||||
BLEDevice::removePeerDevice(m_appId, true);
|
|
||||||
esp_ble_gattc_app_unregister(m_gattc_if);
|
esp_ble_gattc_app_unregister(m_gattc_if);
|
||||||
|
m_semaphoreOpenEvt.give(ESP_GATT_IF_NONE);
|
||||||
m_semaphoreRssiCmplEvt.give();
|
m_semaphoreRssiCmplEvt.give();
|
||||||
m_semaphoreSearchCmplEvt.give(1);
|
m_semaphoreSearchCmplEvt.give(1);
|
||||||
|
BLEDevice::removePeerDevice(m_appId, true);
|
||||||
break;
|
break;
|
||||||
} // ESP_GATTC_DISCONNECT_EVT
|
} // ESP_GATTC_DISCONNECT_EVT
|
||||||
|
|
||||||
|
@ -400,7 +400,6 @@ std::string BLERemoteCharacteristic::readValue() {
|
|||||||
// Check to see that we are connected.
|
// Check to see that we are connected.
|
||||||
if (!getRemoteService()->getClient()->isConnected()) {
|
if (!getRemoteService()->getClient()->isConnected()) {
|
||||||
log_e("Disconnected");
|
log_e("Disconnected");
|
||||||
// throw BLEDisconnectedException(); TODO:: think about error reporting mechanism
|
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,7 +551,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool resp
|
|||||||
// Check to see that we are connected.
|
// Check to see that we are connected.
|
||||||
if (!getRemoteService()->getClient()->isConnected()) {
|
if (!getRemoteService()->getClient()->isConnected()) {
|
||||||
log_e("Disconnected");
|
log_e("Disconnected");
|
||||||
// throw BLEDisconnectedException();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_semaphoreWriteCharEvt.take("writeValue");
|
m_semaphoreWriteCharEvt.take("writeValue");
|
||||||
|
@ -55,7 +55,6 @@ std::string BLERemoteDescriptor::readValue() {
|
|||||||
// Check to see that we are connected.
|
// Check to see that we are connected.
|
||||||
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
||||||
log_e("Disconnected");
|
log_e("Disconnected");
|
||||||
// throw BLEDisconnectedException(); TODO:: think about error reporting mechanism
|
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +133,6 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response
|
|||||||
// Check to see that we are connected.
|
// Check to see that we are connected.
|
||||||
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
||||||
log_e("Disconnected");
|
log_e("Disconnected");
|
||||||
// throw BLEDisconnectedException(); TODO:: think about error reporting mechanism
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user