wifi: Make sure correct beacon interval is set

This commit is contained in:
Sébastien Deronne
2019-01-23 22:29:15 +01:00
parent 04682bb62e
commit 017cfaa770
2 changed files with 6 additions and 3 deletions

View File

@@ -301,8 +301,7 @@ main (int argc, char *argv[])
NetDeviceContainer staDevices = wifiInfra.Install (wifiPhy, macInfra, stas);
// setup ap.
macInfra.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconInterval", TimeValue (Seconds (2.5)));
"Ssid", SsidValue (ssid));
NetDeviceContainer apDevices = wifiInfra.Install (wifiPhy, macInfra, backbone.Get (i));
// Collect all of these new devices
NetDeviceContainer infraDevices (apDevices, staDevices);

View File

@@ -199,7 +199,11 @@ ApWifiMac::SetBeaconInterval (Time interval)
NS_LOG_FUNCTION (this << interval);
if ((interval.GetMicroSeconds () % 1024) != 0)
{
NS_LOG_WARN ("beacon interval should be multiple of 1024us (802.11 time unit), see IEEE Std. 802.11-2012");
NS_FATAL_ERROR ("beacon interval should be multiple of 1024us (802.11 time unit), see IEEE Std. 802.11-2012");
}
if (interval.GetMicroSeconds () > (1024 * 65535))
{
NS_FATAL_ERROR ("beacon interval should be smaller then or equal to 65535 * 1024us (802.11 time unit)");
}
m_low->SetBeaconInterval (interval);
}