Skip to content

Commit

Permalink
Merge branch 'feature/ble-deinit-event' into 'main'
Browse files Browse the repository at this point in the history
Added an event when BLE is deinitialized and memory is reclaimed

See merge request app-frameworks/esp-matter!579
  • Loading branch information
dhrishi committed Dec 21, 2023
2 parents 03aa3db + 5bebd3b commit de46e80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/esp_matter/esp_matter.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ enum
/** Signals that operational credentials are changed, which may not be persistent.
Can be used to affect what is needed for UpdateNOC prior to commit */
kFabricUpdated,
/** Signals that BLE is deinitialized and heap memory is reclaimed */
kBLEDeinitialized,
};

} // DeviceEventType
Expand Down
1 change: 1 addition & 0 deletions components/esp_matter/esp_matter_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ static void deinit_ble_if_commissioned(void)
return;
}
ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed");
PostEvent(chip::DeviceLayer::DeviceEventType::kBLEDeinitialized);
}
#endif /* CONFIG_BT_ENABLED && CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING */
}
Expand Down
5 changes: 5 additions & 0 deletions examples/light/main/app_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
case chip::DeviceLayer::DeviceEventType::kFabricCommitted:
ESP_LOGI(TAG, "Fabric is committed");
break;

case chip::DeviceLayer::DeviceEventType::kBLEDeinitialized:
ESP_LOGI(TAG, "BLE deinitialized and memory reclaimed");
break;

default:
break;
}
Expand Down

0 comments on commit de46e80

Please sign in to comment.