From 283c908e904a0f05f297364450ef9b1752cb55a4 Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:47:29 +0530 Subject: [PATCH] [Silabs][WiFi] CNET 4.4 test step fix for NetworkNotFound (#32729) * adding the network not found fix for cnet * Restyled by clang-format * modifying it to be guard style * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/platform/silabs/NetworkCommissioningWiFiDriver.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp index d6d28e189d821c..f798054932e692 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp @@ -278,6 +278,15 @@ void SlWiFiDriver::OnScanWiFiNetworkDone(wfx_wifi_scan_result_t * aScanResult) { if (GetInstance().mpScanCallback != nullptr) { + if (mScanResponseIter.Count() == 0) + { + // if there is no network found, return kNetworkNotFound + DeviceLayer::SystemLayer().ScheduleLambda([]() { + GetInstance().mpScanCallback->OnFinished(NetworkCommissioning::Status::kNetworkNotFound, CharSpan(), nullptr); + GetInstance().mpScanCallback = nullptr; + }); + return; + } DeviceLayer::SystemLayer().ScheduleLambda([]() { GetInstance().mpScanCallback->OnFinished(NetworkCommissioning::Status::kSuccess, CharSpan(), &mScanResponseIter); GetInstance().mpScanCallback = nullptr;