5#include "nr-ch-access-manager.h"
13NS_LOG_COMPONENT_DEFINE(
"NrChAccessManager");
14NS_OBJECT_ENSURE_REGISTERED(NrChAccessManager);
19 static TypeId tid = TypeId(
"ns3::NrChAccessManager")
22 .AddAttribute(
"GrantDuration",
23 "Duration of grant for transmitting.",
24 TimeValue(Minutes(1)),
33 NS_LOG_FUNCTION(
this);
38 NS_LOG_FUNCTION(
this);
44 NS_LOG_FUNCTION(
this);
45 m_grantDuration = grantDuration;
51 NS_LOG_FUNCTION(
this);
52 return m_grantDuration;
58 NS_LOG_FUNCTION(
this);
59 m_spectrumPhy = spectrumPhy;
65 NS_LOG_FUNCTION(
this);
72 NS_LOG_FUNCTION(
this);
79 NS_LOG_FUNCTION(
this);
90 static TypeId tid = TypeId(
"ns3::NrAlwaysOnAccessManager")
100 NS_LOG_FUNCTION(
this);
105 NS_LOG_FUNCTION(
this);
111 NS_LOG_FUNCTION(
this);
113 for (
const auto& cb : m_accessGrantedCb)
115 cb(Time::Max() - Simulator::Now());
122 NS_LOG_FUNCTION(
this);
123 m_accessGrantedCb.push_back(cb);
130 NS_LOG_FUNCTION(
this);
137 NS_LOG_FUNCTION(
this);
A Channel access manager that sees the channel always free for transmitting.
void Cancel() override
Cancel a previously invoked request for accessing the channel.
NrAlwaysOnAccessManager()
NrAlwaysOnAccessManager constructor.
void RequestAccess() override
RequestAccess.
void SetAccessGrantedCallback(const AccessGrantedCallback &cb) override
Set Access-Granted Callback.
~NrAlwaysOnAccessManager() override
destructor
static TypeId GetTypeId()
Get the type ID.
void SetAccessDeniedCallback(const AccessDeniedCallback &cb) override
Set Access-Denied Callback.
The Channel Access Manager class.
Time GetGrantDuration() const
Get grant duration time.
void SetGrantDuration(Time grantDuration)
Set duration of grant for transmission.
~NrChAccessManager() override
~ChannelAccessManager
virtual void SetNrGnbMac(Ptr< NrGnbMac > mac)
Set MAC instance for this channel access manager.
std::function< void(const Time &time)> AccessGrantedCallback
A function that signal that the channel has been earned.
std::function< void()> AccessDeniedCallback
A function that signal that the channel is denied and the request should be retried.
Ptr< NrGnbMac > GetNrGnbMac()
Getter for MAC instance to which is connected this channel access manager.
NrChAccessManager()
ChannelAccessManager constructor.
virtual void SetNrSpectrumPhy(Ptr< NrSpectrumPhy > spectrumPhy)
Set spectrum phy instance for this channel access manager.
static TypeId GetTypeId()
Get the type ID.
Ptr< NrSpectrumPhy > GetNrSpectrumPhy()
Getter for spectrum phy instance to which is connected this channel access manager.