Skip to content

Commit

Permalink
ESP32: report network status change only when IM engine and the data …
Browse files Browse the repository at this point in the history
…model provider is ready (#36939)

* ESP32: report network status change only when the data model provider is set

* skip gn check for the interaction model engine include line
  • Loading branch information
wqx6 authored Jan 7, 2025
1 parent 621b9c9 commit f8d457a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/platform/ESP32/NetworkCommissioningDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

#include <app/InteractionModelEngine.h> // nogncheck
#include <lib/support/CodeUtils.h>
#include <lib/support/SafeInt.h>
#include <platform/CHIPDeviceLayer.h>
Expand Down Expand Up @@ -458,6 +459,9 @@ void ESPWiFiDriver::OnScanWiFiNetworkDone()

void ESPWiFiDriver::OnNetworkStatusChange()
{
// This function reports the status to the data model provider, so skip it if the provider is not ready.
VerifyOrReturn(app::InteractionModelEngine::GetInstance() &&
app::InteractionModelEngine::GetInstance()->GetDataModelProvider());
Network configuredNetwork;
bool staEnabled = false, staConnected = false;
VerifyOrReturn(ESP32Utils::IsStationEnabled(staEnabled) == CHIP_NO_ERROR);
Expand Down

0 comments on commit f8d457a

Please sign in to comment.