31 .AddConstructor<GatewayLorawanMac>()
32 .SetGroupName(
"lorawan");
53 packet->RemovePacketTag(tag);
60 packet->AddPacketTag(tag);
66 NS_LOG_WARN(
"Trying to send a packet but Duty Cycle won't allow it. Aborting.");
72 params.headerDisabled =
false;
73 params.codingRate = 1;
76 params.crcEnabled =
true;
92 m_phy->Send(packet, params, frequency, sendingPower);
100 return m_phy->IsTransmitting();
113 packetCopy->PeekHeader(macHdr);
125 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.
static Time GetOnAirTime(Ptr< Packet > packet, LoraTxParameters txParams)
Compute the time that a packet with certain characteristics will take to be transmitted.
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.
Ptr< 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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Structure to collect all parameters that are used to compute the duration of a packet (excluding payl...