Skip to content

Commit

Permalink
Fix to allow scanning for all networks
Browse files Browse the repository at this point in the history
  • Loading branch information
senthilku committed Dec 6, 2024
1 parent 85bf162 commit cdfaffd
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,16 @@ int32_t wfx_reset_counts(void)
bool wfx_start_scan(char * ssid, void (*callback)(wfx_wifi_scan_result_t *))
{
// check if already in progress
VerifyOrReturnError(wfx_rsi.scan_cb != nullptr, false);
VerifyOrReturnError(wfx_rsi.scan_cb == nullptr, false);
wfx_rsi.scan_cb = callback;

VerifyOrReturnError(ssid != nullptr, false);
wfx_rsi.scan_ssid_length = strnlen(ssid, std::min<size_t>(sizeof(ssid), WFX_MAX_SSID_LENGTH));
wfx_rsi.scan_ssid = reinterpret_cast<char *>(chip::Platform::MemoryAlloc(wfx_rsi.scan_ssid_length));
VerifyOrReturnError(wfx_rsi.scan_ssid != nullptr, false);
chip::Platform::CopyString(wfx_rsi.scan_ssid, wfx_rsi.scan_ssid_length, ssid);
if (ssid != nullptr)
{
wfx_rsi.scan_ssid_length = strnlen(ssid, std::min<size_t>(sizeof(ssid), WFX_MAX_SSID_LENGTH));
wfx_rsi.scan_ssid = reinterpret_cast<char *>(chip::Platform::MemoryAlloc(wfx_rsi.scan_ssid_length));
VerifyOrReturnError(wfx_rsi.scan_ssid != nullptr, false);
chip::Platform::CopyString(wfx_rsi.scan_ssid, wfx_rsi.scan_ssid_length, ssid);
}

WifiEvent event = WifiEvent::kScan;
sl_matter_wifi_post_event(event);
Expand Down

0 comments on commit cdfaffd

Please sign in to comment.