Skip to content

Commit

Permalink
Revert "Platform Event when ble is deinitialized (project-chip#33186) (
Browse files Browse the repository at this point in the history
…project-chip#33211)"

This reverts commit 0ac02ea.

Signed-off-by: Adrian Gielniewski <[email protected]>
  • Loading branch information
adigie committed Nov 28, 2024
1 parent ff507c6 commit 3905d38
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
4 changes: 0 additions & 4 deletions examples/platform/esp32/common/CommonDeviceCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ void CommonDeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, i
{
switch (event->Type)
{
case DeviceEventType::kBLEDeinitialized:
ESP_LOGI(TAG, "BLE is deinitialized");
break;

case DeviceEventType::kInternetConnectivityChange:
OnInternetConnectivityChange(event);
break;
Expand Down
5 changes: 0 additions & 5 deletions src/include/platform/CHIPDeviceEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,6 @@ enum PublicEventTypes
* sending messages to other nodes.
*/
kServerReady,

/**
* Signals that BLE is deinitialized.
*/
kBLEDeinitialized,
};

/**
Expand Down
9 changes: 3 additions & 6 deletions src/platform/ESP32/nimble/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,20 +1027,17 @@ void BLEManagerImpl::ClaimBLEMemory(System::Layer *, void *)

VerifyOrReturn(err == ESP_OK, ChipLogError(DeviceLayer, "BLE deinit failed"));
ChipLogProgress(DeviceLayer, "BLE deinit successful and memory reclaimed");

ChipDeviceEvent event;
event.Type = DeviceEventType::kBLEDeinitialized;
VerifyOrDo(CHIP_NO_ERROR == PlatformMgr().PostEvent(&event), ChipLogError(DeviceLayer, "Failed to post BLE deinit event"));
// TODO: post an event when ble is deinitialized and memory is added to heap
}
}

CHIP_ERROR BLEManagerImpl::DeinitBLE()
{
esp_err_t err = ESP_OK;
VerifyOrReturnError(ble_hs_is_enabled(), CHIP_ERROR_INCORRECT_STATE, ChipLogProgress(DeviceLayer, "BLE already deinited"));
VerifyOrReturnError(0 == nimble_port_stop(), MapBLEError(ESP_FAIL), ChipLogError(DeviceLayer, "nimble_port_stop() failed"));

nimble_port_deinit();
esp_err_t err = nimble_port_deinit();
VerifyOrReturnError(err == ESP_OK, MapBLEError(err));

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
err = esp_nimble_hci_and_controller_deinit();
Expand Down

0 comments on commit 3905d38

Please sign in to comment.