Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds GetSupportedWiFiBandsMask API #325

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/platform/silabs/NetworkCommissioningWiFiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ chip::BitFlags<WiFiSecurity> SlWiFiDriver::ConvertSecuritytype(wfx_sec_t securit
return securityType;
}

uint32_t SlWiFiDriver::GetSupportedWiFiBandsMask() const

Choose a reason for hiding this comment

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

So currently we don't use this new method?

{
return WifiInterface::GetInstance()._GetSupportedWiFiBandsMask();
}

bool SlWiFiDriver::StartScanWiFiNetworks(ByteSpan ssid)
{
ChipLogProgress(DeviceLayer, "Start Scan WiFi Networks");
Expand Down
1 change: 1 addition & 0 deletions src/platform/silabs/NetworkCommissioningWiFiDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class SlWiFiDriver final : public WiFiDriver
CHIP_ERROR ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, const char * key, uint8_t keyLen);

chip::BitFlags<WiFiSecurity> ConvertSecuritytype(wfx_sec_t security);
uint32_t GetSupportedWiFiBandsMask() const override;

void OnConnectWiFiNetwork();
void UpdateNetworkingStatus();
Expand Down
1 change: 1 addition & 0 deletions src/platform/silabs/wifi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ source_set("wifi-platform") {
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/inet",
"${chip_root}/src/lib/support",
"${chip_root}/src/platform:platform_base",
]

if (use_rs9116) {
Expand Down
16 changes: 16 additions & 0 deletions src/platform/silabs/wifi/WifiInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
*/
#pragma once

#include <app-common/zap-generated/cluster-enums.h>

Choose a reason for hiding this comment

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

This include will also be necessary in the other PR (but i think it gets merged in this branch anywais)

#include <app/icd/server/ICDServerConfig.h>

#include <array>
#include <cmsis_os2.h>
#include <lib/support/BitFlags.h>
Expand Down Expand Up @@ -410,6 +412,20 @@ class WifiInterface
*/
virtual void CancelScanNetworks() = 0;

using WiFiBandEnum = app::Clusters::NetworkCommissioning::WiFiBandEnum;

Choose a reason for hiding this comment

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

We should avoid as much as possible of having a using in a header file.

/**
* @brief Provide all the frequency bands supported by the Wi-Fi interface.
*
* The default implementation returns the 2.4 GHz band support.
*
* @return a bitmask of supported Wi-Fi bands where each bit is associated with a WiFiBandEnum value.
*/
virtual uint32_t _GetSupportedWiFiBandsMask() const

Choose a reason for hiding this comment

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

Suggested change
virtual uint32_t _GetSupportedWiFiBandsMask() const
virtual uint32_t GetSupportedWiFiBandsMask() const

{
// Default to 2.4G support only
return static_cast<uint32_t>(1UL << chip::to_underlying(WiFiBandEnum::k2g4));

Choose a reason for hiding this comment

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

Do we know the bitmap expected mapping? Where is this defined?

}

protected:
/**
* @brief Function notifies the PlatformManager that an IPv6 event occured on the WiFi interface.
Expand Down