A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::lorawan::GatewayLorawanMac Class Reference

Class representing the MAC layer of a LoRaWAN gateway. More...

#include "gateway-lorawan-mac.h"

+ Inheritance diagram for ns3::lorawan::GatewayLorawanMac:
+ Collaboration diagram for ns3::lorawan::GatewayLorawanMac:

Public Member Functions

 GatewayLorawanMac ()
 Default constructor.
 
 ~GatewayLorawanMac () override
 Destructor.
 
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 failed.
 
Time GetWaitingTime (double frequency)
 Return the next time at which we will be able to transmit on the specified frequency.
 
bool IsTransmitting ()
 Check whether the underlying PHY layer of the gateway is currently transmitting.
 
void Receive (Ptr< const Packet > packet) override
 Receive a packet from the lower layer.
 
void Send (Ptr< Packet > packet) override
 Send a packet.
 
void TxFinished (Ptr< const Packet > packet) override
 Perform actions after sending a packet.
 
- Public Member Functions inherited from ns3::lorawan::LorawanMac
 LorawanMac ()
 Default constructor.
 
 ~LorawanMac () override
 Destructor.
 
virtual void FailedReception (Ptr< const Packet > packet)=0
 Function called by lower layers to inform this layer that reception of a packet we were locked on failed.
 
double GetBandwidthFromDataRate (uint8_t dataRate)
 Get the bandwidth corresponding to a data rate, based on this MAC's region.
 
double GetDbmForTxPower (uint8_t txPower)
 Get the transmission power in dBm that corresponds, in this region, to the encoded 8-bit txPower.
 
Ptr< NetDeviceGetDevice ()
 Get the device this MAC layer is installed on.
 
LogicalLoraChannelHelper GetLogicalLoraChannelHelper ()
 Get the logical lora channel helper associated with this MAC.
 
int GetNPreambleSymbols () const
 Get the number of PHY preamble symbols this MAC is set to use.
 
Ptr< LoraPhyGetPhy ()
 Get the underlying PHY layer.
 
uint8_t GetSfFromDataRate (uint8_t dataRate)
 Get the spreading factor corresponding to a data rate, based on this MAC's region.
 
virtual void Receive (Ptr< const Packet > packet)=0
 Receive a packet from the lower layer.
 
virtual void Send (Ptr< Packet > packet)=0
 Send a packet.
 
void SetBandwidthForDataRate (std::vector< double > bandwidthForDataRate)
 Set the vector to use to check up correspondence between bandwidth and data rate.
 
void SetDevice (Ptr< NetDevice > device)
 Set the device this MAC layer is installed on.
 
void SetLogicalLoraChannelHelper (LogicalLoraChannelHelper helper)
 Set the LogicalLoraChannelHelper this MAC instance will use.
 
void SetMaxAppPayloadForDataRate (std::vector< uint32_t > maxAppPayloadForDataRate)
 Set the maximum App layer payload for a set data rate.
 
void SetNPreambleSymbols (int nPreambleSymbols)
 Set the number of PHY preamble symbols this MAC is set to use.
 
void SetPhy (Ptr< LoraPhy > phy)
 Set the underlying PHY layer.
 
void SetReplyDataRateMatrix (ReplyDataRateMatrix replyDataRateMatrix)
 Set the matrix to use when deciding with which data rate to respond.
 
void SetSfForDataRate (std::vector< uint8_t > sfForDataRate)
 Set the vector to use to check up correspondence between spreading factor and data rate.
 
void SetTxDbmForTxPower (std::vector< double > txDbmForTxPower)
 Set the vector to use to check up which transmission power in Dbm corresponds to a certain TxPower value in this MAC's region.
 
virtual void TxFinished (Ptr< const Packet > packet)=0
 Perform actions after sending a packet.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::lorawan::LorawanMac
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Additional Inherited Members

- Public Types inherited from ns3::lorawan::LorawanMac
typedef std::array< std::array< uint8_t, 6 >, 8 > ReplyDataRateMatrix
 Matrix structure to store possible data rate value to be used by a LoRaWAN end device for listening during the RX1 receive window.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 
- Protected Attributes inherited from ns3::lorawan::LorawanMac
std::vector< doublem_bandwidthForDataRate
 A vector holding the bandwidth each data rate corresponds to.
 
TracedCallback< Ptr< const Packet > > m_cannotSendBecauseDutyCycle
 The trace source that is fired when a packet cannot be sent because of duty cycle limitations.
 
LogicalLoraChannelHelper m_channelHelper
 The LogicalLoraChannelHelper instance that is assigned to this MAC.
 
Ptr< NetDevicem_device
 The device this MAC layer is installed on.
 
std::vector< uint32_tm_maxAppPayloadForDataRate
 A vector holding the maximum app payload size that corresponds to a certain data rate.
 
int m_nPreambleSymbols
 The number of symbols to use in the PHY preamble.
 
Ptr< LoraPhym_phy
 The PHY instance that sits under this MAC layer.
 
TracedCallback< Ptr< const Packet > > m_receivedPacket
 Trace source that is fired when a packet reaches the MAC layer.
 
ReplyDataRateMatrix m_replyDataRateMatrix
 The matrix that decides the data rate the gateway will use in a reply based on the end device's sending data rate and on the value of the RX1DROffset parameter.
 
TracedCallback< Ptr< const Packet > > m_sentNewPacket
 Trace source that is fired when a new APP layer packet arrives at the MAC layer.
 
std::vector< uint8_t > m_sfForDataRate
 A vector holding the spreading factor each data rate corresponds to.
 
std::vector< doublem_txDbmForTxPower
 A vector holding the power that corresponds to a certain TxPower value.
 

Detailed Description

Class representing the MAC layer of a LoRaWAN gateway.

Definition at line 36 of file gateway-lorawan-mac.h.

Constructor & Destructor Documentation

◆ GatewayLorawanMac()

ns3::lorawan::GatewayLorawanMac::GatewayLorawanMac ( )

Default constructor.

Definition at line 47 of file gateway-lorawan-mac.cc.

References NS_LOG_FUNCTION.

◆ ~GatewayLorawanMac()

ns3::lorawan::GatewayLorawanMac::~GatewayLorawanMac ( )
override

Destructor.

Definition at line 52 of file gateway-lorawan-mac.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ FailedReception()

void ns3::lorawan::GatewayLorawanMac::FailedReception ( Ptr< const Packet packet)
overridevirtual

Function called by lower layers to inform this layer that reception of a packet we were locked on failed.

Parameters
packetThe packet we failed to receive.

Implements ns3::lorawan::LorawanMac.

Definition at line 141 of file gateway-lorawan-mac.cc.

References NS_LOG_FUNCTION.

◆ GetTypeId()

TypeId ns3::lorawan::GatewayLorawanMac::GetTypeId ( )
static

Register this type.

Returns
The object TypeId.

Definition at line 38 of file gateway-lorawan-mac.cc.

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ GetWaitingTime()

Time ns3::lorawan::GatewayLorawanMac::GetWaitingTime ( double  frequency)

Return the next time at which we will be able to transmit on the specified frequency.

Parameters
frequencyThe frequency value [MHz].
Returns
The next transmission time.

Definition at line 153 of file gateway-lorawan-mac.cc.

References ns3::lorawan::LogicalLoraChannelHelper::GetWaitingTime(), ns3::lorawan::LorawanMac::m_channelHelper, and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

◆ IsTransmitting()

bool ns3::lorawan::GatewayLorawanMac::IsTransmitting ( )

Check whether the underlying PHY layer of the gateway is currently transmitting.

Returns
True if it is transmitting, false otherwise.

Definition at line 109 of file gateway-lorawan-mac.cc.

References ns3::lorawan::LorawanMac::m_phy.

◆ Receive()

void ns3::lorawan::GatewayLorawanMac::Receive ( Ptr< const Packet packet)
overridevirtual

Receive a packet from the lower layer.

Parameters
packetThe received packet.

Implements ns3::lorawan::LorawanMac.

Definition at line 115 of file gateway-lorawan-mac.cc.

References ns3::lorawan::LorawanMacHeader::IsUplink(), ns3::lorawan::LorawanMac::m_device, ns3::lorawan::LorawanMac::m_receivedPacket, NS_LOG_DEBUG, NS_LOG_FUNCTION, and Receive().

Referenced by Receive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Send()

◆ TxFinished()

void ns3::lorawan::GatewayLorawanMac::TxFinished ( Ptr< const Packet packet)
overridevirtual

Perform actions after sending a packet.

Parameters
packetThe packet that just finished transmission.

Implements ns3::lorawan::LorawanMac.

Definition at line 147 of file gateway-lorawan-mac.cc.

References NS_LOG_FUNCTION_NOARGS.


The documentation for this class was generated from the following files: