Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs committed Dec 19, 2024
1 parent 57f4b75 commit 878f7bd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
10 changes: 9 additions & 1 deletion src/platform/silabs/NetworkCommissioningWiFiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,15 @@ chip::BitFlags<WiFiSecurity> SlWiFiDriver::ConvertSecuritytype(wfx_sec_t securit
bool SlWiFiDriver::StartScanWiFiNetworks(ByteSpan ssid)
{
ChipLogProgress(DeviceLayer, "Start Scan WiFi Networks");
return StartNetworkScan(ssid, OnScanWiFiNetworkDone) == CHIP_NO_ERROR;
CHIP_ERROR err = StartNetworkScan(ssid, OnScanWiFiNetworkDone);

if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "StartNetworkScan failed: %s", chip::ErrorStr(err));
return false;
}

return true;
}

void SlWiFiDriver::OnScanWiFiNetworkDone(wfx_wifi_scan_result_t * aScanResult)
Expand Down
4 changes: 2 additions & 2 deletions src/platform/silabs/wifi/SiWx/WifiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ constexpr uint16_t kWifiScanTimeoutTicks = 10000;
*/
sl_status_t BackgroundScanCallback(sl_wifi_event_t event, sl_wifi_scan_result_t * result, uint32_t result_length, void * arg)
{
SL_WIFI_ARGS_CHECK_NULL_POINTER(result);
VerifyOrReturnError(result != nullptr, SL_STATUS_NULL_POINTER);
VerifyOrReturnError(wfx_rsi.scan_cb != nullptr, SL_STATUS_INVALID_HANDLE);

uint32_t nbreResults = result->scan_count;
Expand Down Expand Up @@ -871,7 +871,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip)
/*
* Acquire the new IP address
*/
wfx_rsi.ip4_addr[0] = (ip) &0xFF;
wfx_rsi.ip4_addr[0] = (ip) & 0xFF;
wfx_rsi.ip4_addr[1] = (ip >> 8) & 0xFF;
wfx_rsi.ip4_addr[2] = (ip >> 16) & 0xFF;
wfx_rsi.ip4_addr[3] = (ip >> 24) & 0xFF;
Expand Down
5 changes: 3 additions & 2 deletions src/platform/silabs/wifi/rs911x/WifiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ void ProcessEvent(WifiPlatformEvent event)
chip::ByteSpan requestedSsid(wfx_rsi.scan_ssid, wfx_rsi.scan_ssid_length);
if (!requestedSsid.empty() && !requestedSsid.data_equal(scannedSsid))
{
continue; // we found the targeted ssid.
// Scanned SSID entry does not match the requested SSID. Continue to the next.
continue;
}

// TODO: convert security mode from RSI to WFX
Expand Down Expand Up @@ -810,7 +811,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip)
/*
* Acquire the new IP address
*/
wfx_rsi.ip4_addr[0] = (ip) &0xFF;
wfx_rsi.ip4_addr[0] = (ip) & 0xFF;
wfx_rsi.ip4_addr[1] = (ip >> 8) & 0xFF;
wfx_rsi.ip4_addr[2] = (ip >> 16) & 0xFF;
wfx_rsi.ip4_addr[3] = (ip >> 24) & 0xFF;
Expand Down
9 changes: 8 additions & 1 deletion src/platform/silabs/wifi/wf200/WifiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ CHIP_ERROR StartNetworkScan(chip::ByteSpan ssid, ScanCallback callback)
// SSID Max Length that is supported by the Wi-Fi SDK is 32
VerifyOrReturnError(ssid.size() <= WFX_MAX_SSID_LENGTH, CHIP_ERROR_INVALID_STRING_LENGTH);

// Make sure memory is cleared before starting a new scan
if (scan_ssid)
{
chip::Platform::MemoryFree(scan_ssid);
scan_ssid = nullptr;
}

if (ssid.empty())
{
scan_ssid_length = 0;
Expand Down Expand Up @@ -1232,7 +1239,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip)
*/
uint8_t ip4_addr[4];

ip4_addr[0] = (ip) &0xFF;
ip4_addr[0] = (ip) & 0xFF;
ip4_addr[1] = (ip >> 8) & 0xFF;
ip4_addr[2] = (ip >> 16) & 0xFF;
ip4_addr[3] = (ip >> 24) & 0xFF;
Expand Down

0 comments on commit 878f7bd

Please sign in to comment.