Skip to content

[Silabs] Refactor WiFi scan result handling to use NetworkCommissioning::WiFiScanResponse#43591

Open
rosahay-silabs wants to merge 3 commits intoproject-chip:masterfrom
rosahay-silabs:refactor/scan-response-struct
Open

[Silabs] Refactor WiFi scan result handling to use NetworkCommissioning::WiFiScanResponse#43591
rosahay-silabs wants to merge 3 commits intoproject-chip:masterfrom
rosahay-silabs:refactor/scan-response-struct

Conversation

@rosahay-silabs
Copy link
Contributor

@rosahay-silabs rosahay-silabs commented Mar 14, 2026

Summary

Updated the DiagnosticDataProviderImpl and WiFi driver implementations to replace the usage of wfx_wifi_scan_result_t with the NetworkCommissioning::WiFiScanResponse structure. This change improves consistency and aligns with the recent refactoring of WiFi structures. Adjustments were made to method signatures and internal logic to accommodate the new data structure across multiple files, enhancing the overall clarity and maintainability of the codebase.

Related issues

N/A

Testing

Manually tested with commissioning and following scan-network commands:

chip-tool networkcommissioning scan-networks <node-id> 0 --Ssid null --Breadcrumb 1
chip-tool networkcommissioning scan-networks <node-id> 0 --Ssid hex:<ssid-in-hex> --Breadcrumb 2

Readability checklist

The checklist below will help the reviewer finish PR review in time and keep the
code readable:

  • PR title is
    descriptive
  • Apply the
    “When in Rome…”
    rule (coding style)
  • PR size is short
  • Try to avoid "squashing" and "force-update" in commit history
  • CI time didn't increase

See: Pull Request Guidelines

…canResponse

Updated the DiagnosticDataProviderImpl and WiFi driver implementations to replace the usage of wfx_wifi_scan_result_t with the new NetworkCommissioning::WiFiScanResponse structure. This change improves consistency and aligns with the recent refactoring of WiFi structures. Adjustments were made to method signatures and internal logic to accommodate the new data structure across multiple files, enhancing the overall clarity and maintainability of the codebase.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully refactors the WiFi scan result handling to use NetworkCommissioning::WiFiScanResponse instead of the local wfx_wifi_scan_result_t struct. The changes are consistently applied across the diagnostic data provider, WiFi driver, and interface implementation, which improves code consistency and maintainability. The conversion logic is now correctly located at the source of the scan results, simplifying downstream consumers. The use of std::clamp for RSSI values is a good defensive programming practice. I have one minor suggestion to remove a redundant type check.

Comment on lines +269 to +270
VerifyOrReturnError((std::is_same_v<decltype(requestedSsidPtr), sl_wifi_ssid_t *>), SL_STATUS_INVALID_HANDLE,
ChipLogDetail(DeviceLayer, "Expected sl_wifi_ssid_t *"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This type check using std::is_same_v is redundant. The variable requestedSsidPtr is already declared as sl_wifi_ssid_t *, so decltype(requestedSsidPtr) will always resolve to sl_wifi_ssid_t *. The check is equivalent to std::is_same_v<sl_wifi_ssid_t *, sl_wifi_ssid_t *>, which is always true. These lines can be safely removed.

@github-actions
Copy link

github-actions bot commented Mar 14, 2026

PR #43591: Size comparison from 0d30044 to 2a6635a

Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section 0d30044 2a6635a7 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1090298 1090298 0 0.0
RAM 144778 144778 0 0.0
bl616 lighting-app bl616+thread FLASH 1100804 1100804 0 0.0
RAM 104216 104216 0 0.0
bl616+wifi+shell FLASH 1587676 1587676 0 0.0
RAM 98080 98080 0 0.0
bl702 lighting-app bl702+eth FLASH 1053234 1053234 0 0.0
RAM 108381 108381 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 891244 891244 0 0.0
RAM 105756 105756 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 780076 780076 0 0.0
RAM 103332 103332 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 787104 787104 0 0.0
RAM 108516 108516 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 733332 733332 0 0.0
RAM 97324 97324 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 716752 716752 0 0.0
RAM 97484 97484 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 558650 558650 0 0.0
RAM 204504 204504 0 0.0
lock CC3235SF_LAUNCHXL FLASH 591814 591814 0 0.0
RAM 204744 204744 0 0.0
efr32 lock-app BRD4187C FLASH 971764 971764 0 0.0
RAM 125828 125828 0 0.0
BRD4338a FLASH 769948 769948 0 0.0
RAM 236552 236552 0 0.0
window-app BRD4187C FLASH 1075368 1075360 -8 -0.0
RAM 126440 126440 0 0.0
esp32 all-clusters-app c3devkit DRAM 98372 98372 0 0.0
FLASH 1597182 1597182 0 0.0
IRAM 93514 93514 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 858144 858144 0 0.0
RAM 162019 162019 0 0.0
nxp contact mcxw71+release FLASH 736456 736456 0 0.0
RAM 66944 66944 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1709172 1709172 0 0.0
RAM 213948 213948 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1607868 1607868 0 0.0
RAM 210820 210820 0 0.0
light cy8ckit_062s2_43012 FLASH 1471620 1471620 0 0.0
RAM 196996 196996 0 0.0
lock cy8ckit_062s2_43012 FLASH 1497756 1497756 0 0.0
RAM 224740 224740 0 0.0
qpg lighting-app qpg6200+debug FLASH 841228 841228 0 0.0
RAM 127788 127788 0 0.0
lock-app qpg6200+debug FLASH 779920 779920 0 0.0
RAM 118736 118736 0 0.0
realtek light-switch-app rtl8777g FLASH 721176 721176 0 0.0
RAM 113456 113456 0 0.0
lighting-app rtl8777g FLASH 768912 768912 0 0.0
RAM 114696 114696 0 0.0
stm32 light STM32WB5MM-DK FLASH 479728 479728 0 0.0
RAM 141324 141324 0 0.0
telink bridge-app tl7218x FLASH 729288 729288 0 0.0
RAM 95772 95772 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 853768 853768 0 0.0
RAM 44188 44188 0 0.0
tl7218x FLASH 845178 845178 0 0.0
RAM 99576 99576 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 726100 726100 0 0.0
RAM 55752 55752 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 788668 788668 0 0.0
RAM 74928 74928 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 726094 726094 0 0.0
RAM 33232 33232 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 617176 617176 0 0.0
RAM 118244 118244 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 843948 843952 4 0.0
RAM 97284 97284 0 0.0

@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.12%. Comparing base (18f60c6) to head (2a6635a).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #43591      +/-   ##
==========================================
+ Coverage   54.07%   54.12%   +0.05%     
==========================================
  Files        1548     1550       +2     
  Lines      106701   106946     +245     
  Branches    13309    13312       +3     
==========================================
+ Hits        57699    57887     +188     
- Misses      49002    49059      +57     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants