20 #include "ns3/simulator.h"
21 #include "ns3/wifi-phy.h"
67 static TypeId tid =
TypeId (
"ns3::DefaultChannelScheduler")
69 .SetGroupName (
"Wave")
76 : m_channelNumber (0),
79 m_waitChannelNumber (0),
81 m_coordinationListener (0)
123 std::vector<Ptr<WifiPhy> > phys = device->
GetPhys ();
124 if (phys.size () > 1)
126 NS_LOG_WARN (
"The class is only in the context of single-PHY device, while there are more than one PHY devices");
152 uint32_t sch = channelNumber;
189 uint32_t sch = channelNumber;
247 uint32_t sch = channelNumber;
264 if (remainExtends > extends)
338 NS_LOG_DEBUG (
"channel access is already assigned for other SCHs, thus cannot assign default CCH access.");
343 if (
Now ().GetMilliSeconds() != 0)
440 mac->MakeVirtualBusy (duration);
448 mac->MakeVirtualBusy (duration);
#define EXTENDED_CONTINUOUS
receive notifications about channel coordination events.
Time NeedTimeToCchInterval(Time duration=Seconds(0.0)) const
bool IsSchInterval(Time duration=Seconds(0.0)) const
Time GetSyncInterval(void) const
Time NeedTimeToSchInterval(Time duration=Seconds(0.0)) const
void RegisterListener(Ptr< ChannelCoordinationListener > listener)
This class will assign channel access for requests from higher layers.
virtual void DoInitialize(void)
Initialize() implementation.
virtual void DoDispose(void)
Destructor implementation.
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
Ptr< WaveNetDevice > m_device
the device
CoordinationListener class.
CoordinationListener(DefaultChannelScheduler *scheduler)
Constructor.
virtual void NotifyCchSlotStart(Time duration)
DefaultChannelScheduler * m_scheduler
the scheduler
virtual ~CoordinationListener()
virtual void NotifyGuardSlotStart(Time duration, bool cchi)
virtual void NotifySchSlotStart(Time duration)
This class uses a simple mechanism to assign channel access with following features: (1) only in the ...
static TypeId GetTypeId(void)
Get the type ID.
virtual bool AssignDefaultCchAccess(void)
This method will assign default CCH access for CCH.
enum ChannelAccess m_channelAccess
channel access
virtual void DoInitialize(void)
Initialize() implementation.
DefaultChannelScheduler()
virtual void DoDispose(void)
Destructor implementation.
virtual enum ChannelAccess GetAssignedAccessType(uint32_t channelNumber) const
EventId m_extendEvent
extend event
void NotifyGuardSlotStart(Time duration, bool cchi)
Notify guard slot start.
void NotifyCchSlotStart(Time duration)
Notify CCH slot start.
void SwitchToNextChannel(uint32_t curChannelNumber, uint32_t nextChannelNumber)
Ptr< ChannelCoordinator > m_coordinator
channel coordinator
EventId m_waitEvent
wait event
virtual ~DefaultChannelScheduler()
virtual bool AssignAlternatingAccess(uint32_t channelNumber, bool immediate)
virtual bool AssignContinuousAccess(uint32_t channelNumber, bool immediate)
virtual bool AssignExtendedAccess(uint32_t channelNumber, uint32_t extends, bool immediate)
void NotifySchSlotStart(Time duration)
Notify SCH slot start.
uint32_t m_channelNumber
when m_channelAccess is ContinuousAccess, m_channelNumber is continuous channel number; when m_channe...
uint32_t m_waitChannelNumber
wait channel number
uint32_t m_waitExtend
wait extend
Ptr< ChannelCoordinationListener > m_coordinationListener
coordination listener
virtual bool ReleaseAccess(uint32_t channelNumber)
virtual void SetWaveNetDevice(Ptr< WaveNetDevice > device)
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
void Suspend(void)
To support MAC extension for multiple channel operation, Suspend the activity in current MAC entity.
void MakeVirtualBusy(Time duration)
void Resume(void)
To support MAC extension for multiple channel operation, Resume the activity of suspended MAC entity.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
Simulation virtual time values and global simulation resolution.
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< WifiPhy > GetPhy(uint32_t index) const
std::vector< Ptr< WifiPhy > > GetPhys(void) const
Ptr< ChannelCoordinator > GetChannelCoordinator(void) const
Ptr< OcbWifiMac > GetMac(uint32_t channelNumber) const
void ResetWifiPhy(void)
Remove currently attached WifiPhy device from this MAC.
virtual void SetWifiPhy(Ptr< WifiPhy > phy)
uint8_t GetChannelNumber(void) const
Return current channel number.
Time GetChannelSwitchDelay(void) const
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ChannelAccess
ChannelAccess enumeration.