wifi: Ensure frequency segments belong to the same band
This commit is contained in:
@@ -358,16 +358,23 @@ WifiPhyOperatingChannel::Set(const std::vector<FrequencyChannelInfo>& segments,
|
||||
{
|
||||
const auto freq = (*it)->frequency;
|
||||
const auto width = (*it)->width;
|
||||
const auto band = (*it)->band;
|
||||
const auto maxFreq = freq + (width / 2);
|
||||
++it;
|
||||
const auto nextFreq = (*it)->frequency;
|
||||
const auto nextWidth = (*it)->width;
|
||||
const auto nextBand = (*it)->band;
|
||||
const auto nextMinFreq = nextFreq - (nextWidth / 2);
|
||||
if (maxFreq >= nextMinFreq)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"WifiPhyOperatingChannel is invalid: segments cannot be adjacent nor overlap");
|
||||
}
|
||||
if (band != nextBand)
|
||||
{
|
||||
throw std::runtime_error("WifiPhyOperatingChannel is invalid: all segments shall "
|
||||
"belong to the same band");
|
||||
}
|
||||
}
|
||||
|
||||
if ((channelIts.size() > 2) ||
|
||||
|
||||
Reference in New Issue
Block a user