Skip to content

Fix issue with semaphores #2974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libraries/BLE/src/BLEClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,11 @@ void BLEClient::gattClientEventHandler(
if (m_pClientCallbacks != nullptr) {
m_pClientCallbacks->onDisconnect(this);
}
BLEDevice::removePeerDevice(m_appId, true);
esp_ble_gattc_app_unregister(m_gattc_if);
m_semaphoreOpenEvt.give(ESP_GATT_IF_NONE);
m_semaphoreRssiCmplEvt.give();
m_semaphoreSearchCmplEvt.give(1);
BLEDevice::removePeerDevice(m_appId, true);
break;
} // ESP_GATTC_DISCONNECT_EVT

Expand Down
3 changes: 1 addition & 2 deletions libraries/BLE/src/BLERemoteCharacteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ std::string BLERemoteCharacteristic::readValue() {
// Check to see that we are connected.
if (!getRemoteService()->getClient()->isConnected()) {
log_e("Disconnected");
// throw BLEDisconnectedException(); TODO:: think about error reporting mechanism
return std::string();
}

Expand Down Expand Up @@ -552,7 +551,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool resp
// Check to see that we are connected.
if (!getRemoteService()->getClient()->isConnected()) {
log_e("Disconnected");
// throw BLEDisconnectedException();
return;
}

m_semaphoreWriteCharEvt.take("writeValue");
Expand Down
2 changes: 0 additions & 2 deletions libraries/BLE/src/BLERemoteDescriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ std::string BLERemoteDescriptor::readValue() {
// Check to see that we are connected.
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
log_e("Disconnected");
// throw BLEDisconnectedException(); TODO:: think about error reporting mechanism
return std::string();
}

Expand Down Expand Up @@ -134,7 +133,6 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response
// Check to see that we are connected.
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
log_e("Disconnected");
// throw BLEDisconnectedException(); TODO:: think about error reporting mechanism
return;
}

Expand Down