42 .AddConstructor<GatewayLorawanMac>()
43 .SetGroupName(
"lorawan");
64 packet->RemovePacketTag(tag);
71 packet->AddPacketTag(tag);
77 NS_LOG_WARN(
"Trying to send a packet but Duty Cycle won't allow it. Aborting.");
83 params.headerDisabled =
false;
84 params.codingRate = 1;
87 params.crcEnabled =
true;
91 Time duration =
m_phy->GetOnAirTime(packet, params);
103 m_phy->Send(packet, params, frequency, sendingPower);
111 return m_phy->IsTransmitting();
124 packetCopy->PeekHeader(macHdr);
136 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.
double GetSeconds() 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.
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
Function called by lower layers to inform this layer that reception of a packet we were locked on fai...
void Send(Ptr< Packet > packet) override
Send a packet.
void TxFinished(Ptr< const Packet > packet) override
Perform actions after sending a packet.
Time GetWaitingTime(double frequency)
Return the next time at which we will be able to transmit on the specified frequency.
void Receive(Ptr< const Packet > packet) override
Receive a packet from the lower layer.
GatewayLorawanMac()
Default constructor.
double GetTxPowerForChannel(Ptr< LogicalLoraChannel > logicalChannel)
Returns the maximum transmission power [dBm] that is allowed on a channel.
Time GetWaitingTime(Ptr< LogicalLoraChannel > channel)
Get the time it is necessary to wait for before transmitting on a given channel.
void AddEvent(Time duration, Ptr< LogicalLoraChannel > channel)
Register the transmission of a packet.
Hold together all LoRa related objects.
static Time GetTSym(LoraTxParameters txParams)
Compute the symbol time from spreading factor and bandwidth.
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.
double GetFrequency() const
Get the frequency of the packet.
Class representing the LoRaWAN MAC layer.
TracedCallback< Ptr< const Packet > > m_receivedPacket
Trace source that is fired when a packet reaches the MAC layer.
uint8_t GetSfFromDataRate(uint8_t dataRate)
Get the spreading factor corresponding to a data rate, based on this MAC's region.
double GetBandwidthFromDataRate(uint8_t dataRate)
Get the bandwidth corresponding to a data rate, based on this MAC's region.
LogicalLoraChannelHelper m_channelHelper
The LogicalLoraChannelHelper instance that is assigned to this MAC.
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.
Ptr< NetDevice > m_device
The device this MAC layer is installed on.
#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.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
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...