Skip to content

Commit

Permalink
[nrf toup] Fix missing network band in scan response.
Browse files Browse the repository at this point in the history
There is a missing network band parameter in the scan response,
and due to that the `networkcommissioning scan-networks` command
shows 0 as the band field for all found networks.
  • Loading branch information
ArekBalysNordic authored and anangl committed Jun 20, 2024
1 parent bc49aa4 commit 022f2c9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/platform/nrfconnect/wifi/WiFiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ namespace DeviceLayer {

namespace {

app::Clusters::NetworkCommissioning::WiFiBandEnum ConvertBandEnum(uint8_t band)
{
switch (band)
{
case WIFI_FREQ_BAND_2_4_GHZ:
return app::Clusters::NetworkCommissioning::WiFiBandEnum::k2g4;
case WIFI_FREQ_BAND_5_GHZ:
return app::Clusters::NetworkCommissioning::WiFiBandEnum::k5g;
case WIFI_FREQ_BAND_6_GHZ:
return app::Clusters::NetworkCommissioning::WiFiBandEnum::k6g;
default:
return app::Clusters::NetworkCommissioning::WiFiBandEnum::kUnknownEnumValue;
}
}

NetworkCommissioning::WiFiScanResponse ToScanResponse(const wifi_scan_result * result)
{
NetworkCommissioning::WiFiScanResponse response = {};
Expand All @@ -64,6 +79,7 @@ NetworkCommissioning::WiFiScanResponse ToScanResponse(const wifi_scan_result * r
response.channel = result->channel;
response.rssi = result->rssi;
response.ssidLen = result->ssid_length;
response.wiFiBand = ConvertBandEnum(result->band);
memcpy(response.ssid, result->ssid, result->ssid_length);
// TODO: MAC/BSSID is not filled by the Wi-Fi driver
memcpy(response.bssid, result->mac, result->mac_length);
Expand Down

0 comments on commit 022f2c9

Please sign in to comment.