|
55 |
MakeTimeAccessor (&ApWifiMac::GetBeaconInterval, |
55 |
MakeTimeAccessor (&ApWifiMac::GetBeaconInterval, |
56 |
&ApWifiMac::SetBeaconInterval), |
56 |
&ApWifiMac::SetBeaconInterval), |
57 |
MakeTimeChecker ()) |
57 |
MakeTimeChecker ()) |
|
|
58 |
.AddAttribute ("BeaconJitter", "A uniform random variable to cause the initial beacon starting time (after simulation time 0) to be distributed between 0 and the BeaconInterval.", |
59 |
StringValue ("ns3::UniformRandomVariable"), |
60 |
MakePointerAccessor (&ApWifiMac::m_beaconJitter), |
61 |
MakePointerChecker<UniformRandomVariable> ()) |
62 |
.AddAttribute ("EnableBeaconJitter", "If beacons are enabled, whether to jitter the initial send event.", |
63 |
BooleanValue (false), |
64 |
MakeBooleanAccessor (&ApWifiMac::m_enableBeaconJitter), |
65 |
MakeBooleanChecker ()) |
58 |
.AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.", |
66 |
.AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.", |
59 |
BooleanValue (true), |
67 |
BooleanValue (true), |
60 |
MakeBooleanAccessor (&ApWifiMac::SetBeaconGeneration, |
68 |
MakeBooleanAccessor (&ApWifiMac::SetBeaconGeneration, |
|
172 |
SendOneBeacon (); |
180 |
SendOneBeacon (); |
173 |
} |
181 |
} |
174 |
|
182 |
|
|
|
183 |
int64_t |
184 |
ApWifiMac::AssignStreams (int64_t stream) |
185 |
{ |
186 |
NS_LOG_FUNCTION (this << stream); |
187 |
m_beaconJitter->SetStream (stream); |
188 |
return 1; |
189 |
} |
190 |
|
175 |
void |
191 |
void |
176 |
ApWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from, |
192 |
ApWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from, |
177 |
Mac48Address to) |
193 |
Mac48Address to) |
|
648 |
m_beaconEvent.Cancel (); |
664 |
m_beaconEvent.Cancel (); |
649 |
if (m_enableBeaconGeneration) |
665 |
if (m_enableBeaconGeneration) |
650 |
{ |
666 |
{ |
651 |
m_beaconEvent = Simulator::ScheduleNow (&ApWifiMac::SendOneBeacon, this); |
667 |
if (m_enableBeaconJitter) |
|
|
668 |
{ |
669 |
int64_t jitter = m_beaconJitter->GetValue (0, m_beaconInterval.GetMicroSeconds ()); |
670 |
NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress() << " at time " << jitter << " microseconds"); |
671 |
m_beaconEvent = Simulator::Schedule (MicroSeconds (jitter), &ApWifiMac::SendOneBeacon, this); |
672 |
} |
673 |
else |
674 |
{ |
675 |
NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress() << " at time 0"); |
676 |
m_beaconEvent = Simulator::ScheduleNow (&ApWifiMac::SendOneBeacon, this); |
677 |
} |
652 |
} |
678 |
} |
653 |
RegularWifiMac::DoInitialize (); |
679 |
RegularWifiMac::DoInitialize (); |
654 |
} |
680 |
} |