30 .AddConstructor<GatewayLorawanMac>()
31 .SetGroupName(
"lorawan");
52 packet->RemovePacketTag(tag);
59 packet->AddPacketTag(tag);
65 NS_LOG_WARN(
"Trying to send a packet but Duty Cycle won't allow it. Aborting.");
72 auto ldro = bool((sf == 11 || sf == 12) && bw == 125'000);
75 params.spreadingFactor = sf;
76 params.bandwidthHz = bw;
78 params.lowDataRateOptimize = ldro;
79 params.preambleLenSymb = 8;
80 params.implicitHeader =
false;
81 params.crcEnabled =
true;
89 double sendingPower =
m_channelHelper->GetTxPowerForChannel(frequencyHz);
103 return m_phy->IsTransmitting();
129 packetCopy->PeekHeader(macHdr);
143 NS_LOG_DEBUG(
"Not forwarding downlink message to NetDevice");
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Class representing the MAC layer of a LoRaWAN gateway.
bool IsTransmitting()
Check whether the underlying PHY layer of the gateway is currently transmitting.
~GatewayLorawanMac() override
Destructor.
static TypeId GetTypeId()
Register this type.
void FailedReception(Ptr< const Packet > packet) override
Inform this layer that reception of a packet we were locked on failed.
void Send(Ptr< Packet > packet) override
Send a packet.
Time GetWaitTime(uint32_t frequencyHz)
Return the next time at which we will be able to transmit on the specified frequency.
void TxFinished(Ptr< const Packet > packet) override
Perform actions after sending a packet.
void Receive(Ptr< const Packet > packet) override
Receive a packet from the lower layer.
GatewayLorawanMac()
Default constructor.
static Time GetTimeOnAir(uint32_t phyPayloadLen, const LoraTxParameters &txParams)
Compute the total transmission time for a physical packet based on modulation parameters.
Tag used to save various data about a packet, like its Spreading Factor and data about interference.
uint8_t GetDataRate() const
Get the data rate for this packet.
uint32_t GetFrequency() const
Get the frequency of the packet.
LorawanMac()
Default constructor.
TracedCallback< Ptr< const Packet > > m_receivedPacket
Trace source that is fired when a packet reaches the MAC layer.
uint32_t GetBandwidthFromDataRate(uint8_t dataRate) const
Get the bandwidth corresponding to a data rate, based on this MAC's region.
uint8_t GetSfFromDataRate(uint8_t dataRate) const
Get the spreading factor corresponding to a data rate, based on this MAC's region.
Ptr< LogicalLoraChannelHelper > m_channelHelper
The LogicalLoraChannelHelper instance that is assigned to this MAC.
ReceiveCallback m_receiveCallback
! Callback to forward to upper layers
TracedCallback< Ptr< const Packet > > m_sentNewPacket
Trace source that is fired when a new APP layer packet arrives at the MAC layer.
Ptr< LoraPhy > m_phy
The PHY instance that sits under this MAC layer.
#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_NOARGS()
Output the name of the function.
#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.
@ DOWN
Downlink / Downchirp / Inverted polarity.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Structure to collect all parameters that are used to compute the duration of a packet (excluding payl...