wifi: Enable to call WifiPhyOperatingChannel::FindFirst() with unspecified standard

This commit is contained in:
Stefano Avallone
2022-03-19 21:51:31 +01:00
parent 3a155c2607
commit 5534fcf4b6
2 changed files with 8 additions and 7 deletions

View File

@@ -347,7 +347,7 @@ WifiPhyOperatingChannel::FindFirst (uint8_t number, uint16_t frequency, uint16_t
{
return false;
}
if (std::get<3> (channel) != GetFrequencyChannelType (standard))
if (standard != WIFI_STANDARD_UNSPECIFIED && std::get<3> (channel) != GetFrequencyChannelType (standard))
{
return false;
}
@@ -359,12 +359,12 @@ WifiPhyOperatingChannel::FindFirst (uint8_t number, uint16_t frequency, uint16_t
};
// Do not search for a channel matching the specified criteria if the given PHY band
// is not allowed for the given standard or the given channel width is not allowed
// for the given standard
// is not allowed for the given standard (if any) or the given channel width is not
// allowed for the given standard (if any)
if (const auto standardIt = wifiStandards.find (standard);
standardIt == wifiStandards.cend ()
|| std::find (standardIt->second.cbegin (), standardIt->second.cend (), band) == standardIt->second.cend ()
|| width > GetMaximumChannelWidth (standard))
standardIt != wifiStandards.cend ()
&& (std::find (standardIt->second.cbegin (), standardIt->second.cend (), band) == standardIt->second.cend ()
|| width > GetMaximumChannelWidth (standard)))
{
return m_frequencyChannels.cend ();
}

View File

@@ -226,7 +226,8 @@ public:
* \param number the channel number (use 0 to leave it unspecified)
* \param frequency the channel center frequency in MHz (use 0 to leave it unspecified)
* \param width the channel width in MHz (use 0 to leave it unspecified)
* \param standard the standard
* \param standard the standard (use WIFI_STANDARD_UNSPECIFIED not to check whether a
* channel is suitable for a specific standard)
* \param band the PHY band
* \param start an iterator pointing to the channel to start the search with
* \return an iterator pointing to the found channel, if any, or to past-the-end