[Silabs] Refactor WiFi scan result handling to use NetworkCommissioning::WiFiScanResponse#43591
Conversation
…stant for BSSID length.
…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.
There was a problem hiding this comment.
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.
| VerifyOrReturnError((std::is_same_v<decltype(requestedSsidPtr), sl_wifi_ssid_t *>), SL_STATUS_INVALID_HANDLE, | ||
| ChipLogDetail(DeviceLayer, "Expected sl_wifi_ssid_t *")); |
There was a problem hiding this comment.
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.
|
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)
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Summary
Updated the
DiagnosticDataProviderImpland WiFi driver implementations to replace the usage ofwfx_wifi_scan_result_twith theNetworkCommissioning::WiFiScanResponsestructure. 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:
Readability checklist
The checklist below will help the reviewer finish PR review in time and keep the
code readable:
descriptive
“When in Rome…”
rule (coding style)
See: Pull Request Guidelines