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

This class represents the network server's knowledge about an end device in the LoRaWAN network it is administering. More...

#include "end-device-status.h"

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

Classes

struct  PacketInfoPerGw
 Structure saving information regarding the packet reception in each gateway. More...
 
struct  ReceivedPacketInfo
 Structure saving information regarding all packet receptions. More...
 
struct  Reply
 Structure representing the reply that the network server will send this device at the first opportunity. More...
 

Public Types

typedef std::map< Address, PacketInfoPerGwGatewayList
 typedef of a list of gateways with relative reception information.
 
typedef std::list< std::pair< Ptr< const Packet >, ReceivedPacketInfo > > ReceivedPacketList
 typedef of a list of packets paired to their reception info.
 

Public Member Functions

 EndDeviceStatus ()
 Default constructor.
 
 EndDeviceStatus (LoraDeviceAddress endDeviceAddress, Ptr< ClassAEndDeviceLorawanMac > endDeviceMac)
 Constructor with initialization parameters.
 
 ~EndDeviceStatus () override
 Destructor.
 
void AddMACCommand (Ptr< MacCommand > macCommand)
 Add MAC command to the frame header of next reply.
 
Ptr< PacketGetCompleteReplyPacket ()
 Get the reply packet.
 
double GetFirstReceiveWindowFrequency () const
 Get the first window frequency of this device.
 
uint8_t GetFirstReceiveWindowSpreadingFactor () const
 Get the spreading factor this device is using in the first receive window.
 
Ptr< const PacketGetLastPacketReceivedFromDevice ()
 Return the last packet that was received from this device.
 
EndDeviceStatus::ReceivedPacketInfo GetLastReceivedPacketInfo ()
 Return the information about the last packet that was received from the device.
 
Ptr< ClassAEndDeviceLorawanMacGetMac ()
 Get the MAC layer of the end device.
 
std::map< double, AddressGetPowerGatewayMap ()
 Get the gateways which received the last packet from the end device.
 
ReceivedPacketList GetReceivedPacketList () const
 Get the received packet list.
 
LoraFrameHeader GetReplyFrameHeader () const
 Get the reply packet frame header.
 
LorawanMacHeader GetReplyMacHeader () const
 Get the reply packet mac header.
 
Ptr< PacketGetReplyPayload ()
 Get the data of the reply packet.
 
double GetSecondReceiveWindowFrequency () const
 Return the second window frequency of this device.
 
uint8_t GetSecondReceiveWindowSpreadingFactor () const
 Get the spreading factor this device is using in the second receive window.
 
bool HasReceiveWindowOpportunityScheduled ()
 Check if there is already a running reception window event scheduled for this end device.
 
void InitializeReply ()
 Reset the next reply state.
 
void InsertReceivedPacket (Ptr< const Packet > receivedPacket, const Address &gwAddress)
 Insert a received packet in the packet list.
 
bool NeedsReply () const
 Whether the end device needs a reply.
 
void RemoveReceiveWindowOpportunity ()
 Cancel next scheduled reception window event.
 
void SetFirstReceiveWindowFrequency (double frequency)
 Set the first window frequency of this device.
 
void SetFirstReceiveWindowSpreadingFactor (uint8_t sf)
 Set the spreading factor this device is using in the first receive window.
 
void SetReceiveWindowOpportunity (EventId event)
 Store next scheduled reception window event.
 
void SetReplyFrameHeader (LoraFrameHeader frameHeader)
 Set the reply packet frame header.
 
void SetReplyMacHeader (LorawanMacHeader macHeader)
 Set the reply packet mac header.
 
void SetReplyPayload (Ptr< Packet > replyPayload)
 Set the packet reply payload.
 
void SetSecondReceiveWindowFrequency (double frequency)
 Set the second window frequency of this device.
 
void SetSecondReceiveWindowSpreadingFactor (uint8_t sf)
 Set the spreading factor this device is using in the second receive window.
 
- 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, bool permissive=false) 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.
 
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::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Public Attributes

LoraDeviceAddress m_endDeviceAddress
 The address of this device.
 
struct Reply m_reply
 Next reply intended for this device.
 

Private Attributes

double m_firstReceiveWindowFrequency = 0
 Frequency [MHz] for RX1 window.
 
uint8_t m_firstReceiveWindowSpreadingFactor = 0
 Spreading Factor (SF) for RX1 window.
 
Ptr< ClassAEndDeviceLorawanMacm_mac
 Pointer to the MAC layer of this device.
 
ReceivedPacketList m_receivedPacketList
 List of received packets.
 
EventId m_receiveWindowEvent
 Event storing the next scheduled downlink transmission.
 
double m_secondReceiveWindowFrequency = 869.525
 Frequency [MHz] for RX2 window.
 
uint8_t m_secondReceiveWindowSpreadingFactor = 0
 Spreading Factor (SF) for RX2 window.
 

Friends

std::ostream & operator<< (std::ostream &os, const EndDeviceStatus &status)
 Stream insertion operator.
 

Additional Inherited Members

- 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.
 

Detailed Description

This class represents the network server's knowledge about an end device in the LoRaWAN network it is administering.

The network server's NetworkStatus component contains a list of instances of this class, one for each device in the network. Each instance contains all the parameters and information of the end device and the packets received from it. Furthermore, this class holds the reply packet that the network server will send to this device at the first available receive window. Upon new packet arrivals at the network server, the OnReceivedPacket method is called to update the information regarding the last received packet and its parameters.

Diagram of the end-device-status data structure. One instance of this class for each end device, that will be identified by its address.

Public Access:

(End device address) — Current device parameters:

  • First Receive Window Spreading Factor (SF) and Data Rate (DR)
  • First Receive Window frequency
  • Second Window Spreading Factor (SF) and Data Rate (DR)
  • Second Receive Window frequency — Reply
  • Need for reply (true/false)
  • Updated reply — Received Packets
  • Received packets list (see below).

Private Access:

(Received packets list) - List of gateways that received the packet (see below)

  • Spreading Factor (SF) of the received packet
  • Frequency of the received packet
  • Bandwidth of the received packet

(Gateway list) - Time at which the packet was received

  • Reception power

Definition at line 71 of file end-device-status.h.

Member Typedef Documentation

◆ GatewayList

typedef of a list of gateways with relative reception information.

Definition at line 146 of file end-device-status.h.

◆ ReceivedPacketList

typedef of a list of packets paired to their reception info.

Definition at line 163 of file end-device-status.h.

Constructor & Destructor Documentation

◆ EndDeviceStatus() [1/2]

ns3::lorawan::EndDeviceStatus::EndDeviceStatus ( )

Default constructor.

Definition at line 51 of file end-device-status.cc.

References m_receivedPacketList, m_reply, and NS_LOG_FUNCTION_NOARGS.

◆ ~EndDeviceStatus()

ns3::lorawan::EndDeviceStatus::~EndDeviceStatus ( )
override

Destructor.

Definition at line 60 of file end-device-status.cc.

References NS_LOG_FUNCTION_NOARGS.

◆ EndDeviceStatus() [2/2]

ns3::lorawan::EndDeviceStatus::EndDeviceStatus ( LoraDeviceAddress endDeviceAddress,
Ptr< ClassAEndDeviceLorawanMac > endDeviceMac )

Constructor with initialization parameters.

Parameters
endDeviceAddressAddress of the end device.
endDeviceMacPointer to the MAC layer of the end device.

Definition at line 41 of file end-device-status.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AddMACCommand()

void ns3::lorawan::EndDeviceStatus::AddMACCommand ( Ptr< MacCommand > macCommand)

Add MAC command to the frame header of next reply.

Parameters
macCommandThe MAC command.

Definition at line 353 of file end-device-status.cc.

References ns3::lorawan::LoraFrameHeader::AddCommand(), ns3::lorawan::EndDeviceStatus::Reply::frameHeader, and m_reply.

+ Here is the call graph for this function:

◆ GetCompleteReplyPacket()

◆ GetFirstReceiveWindowFrequency()

double ns3::lorawan::EndDeviceStatus::GetFirstReceiveWindowFrequency ( ) const

Get the first window frequency of this device.

Returns
The frequency [MHz].

Definition at line 78 of file end-device-status.cc.

References m_firstReceiveWindowFrequency, and NS_LOG_FUNCTION_NOARGS.

◆ GetFirstReceiveWindowSpreadingFactor()

uint8_t ns3::lorawan::EndDeviceStatus::GetFirstReceiveWindowSpreadingFactor ( ) const

Get the spreading factor this device is using in the first receive window.

Returns
An unsigned 8-bit integer containing the spreading factor.

Definition at line 70 of file end-device-status.cc.

References m_firstReceiveWindowSpreadingFactor, and NS_LOG_FUNCTION_NOARGS.

◆ GetLastPacketReceivedFromDevice()

Ptr< const Packet > ns3::lorawan::EndDeviceStatus::GetLastPacketReceivedFromDevice ( )

Return the last packet that was received from this device.

Returns
The last received packet.

Definition at line 330 of file end-device-status.cc.

References m_receivedPacketList, and NS_LOG_FUNCTION_NOARGS.

Referenced by GetCompleteReplyPacket().

+ Here is the caller graph for this function:

◆ GetLastReceivedPacketInfo()

EndDeviceStatus::ReceivedPacketInfo ns3::lorawan::EndDeviceStatus::GetLastReceivedPacketInfo ( )

Return the information about the last packet that was received from the device.

Returns
The information about the last received packet.

Definition at line 315 of file end-device-status.cc.

References m_receivedPacketList, and NS_LOG_FUNCTION_NOARGS.

◆ GetMac()

Ptr< ClassAEndDeviceLorawanMac > ns3::lorawan::EndDeviceStatus::GetMac ( )

Get the MAC layer of the end device.

Returns
A pointer to the MAC layer.

Definition at line 167 of file end-device-status.cc.

References m_mac.

◆ GetPowerGatewayMap()

std::map< double, Address > ns3::lorawan::EndDeviceStatus::GetPowerGatewayMap ( )

Get the gateways which received the last packet from the end device.

Gateways are mapped to their measured reception power of the last packet, in ascending order.

Returns
The ordered map of reception power values and gateways.

Definition at line 377 of file end-device-status.cc.

References ns3::lorawan::EndDeviceStatus::ReceivedPacketInfo::gwList, and m_receivedPacketList.

◆ GetReceivedPacketList()

EndDeviceStatus::ReceivedPacketList ns3::lorawan::EndDeviceStatus::GetReceivedPacketList ( ) const

Get the received packet list.

Returns
The received packet list.

Definition at line 173 of file end-device-status.cc.

References m_receivedPacketList, and NS_LOG_FUNCTION_NOARGS.

◆ GetReplyFrameHeader()

LoraFrameHeader ns3::lorawan::EndDeviceStatus::GetReplyFrameHeader ( ) const

Get the reply packet frame header.

Returns
The packet reply frame header.

Definition at line 153 of file end-device-status.cc.

References ns3::lorawan::EndDeviceStatus::Reply::frameHeader, m_reply, and NS_LOG_FUNCTION_NOARGS.

◆ GetReplyMacHeader()

LorawanMacHeader ns3::lorawan::EndDeviceStatus::GetReplyMacHeader ( ) const

Get the reply packet mac header.

Returns
The packet reply mac header.

Definition at line 146 of file end-device-status.cc.

References m_reply, ns3::lorawan::EndDeviceStatus::Reply::macHeader, and NS_LOG_FUNCTION_NOARGS.

◆ GetReplyPayload()

Ptr< Packet > ns3::lorawan::EndDeviceStatus::GetReplyPayload ( )

Get the data of the reply packet.

Returns
A pointer to the packet reply.

Definition at line 160 of file end-device-status.cc.

References ns3::Packet::Copy(), m_reply, NS_LOG_FUNCTION_NOARGS, and ns3::lorawan::EndDeviceStatus::Reply::payload.

+ Here is the call graph for this function:

◆ GetSecondReceiveWindowFrequency()

double ns3::lorawan::EndDeviceStatus::GetSecondReceiveWindowFrequency ( ) const

Return the second window frequency of this device.

Returns
The frequency [MHz].

Definition at line 94 of file end-device-status.cc.

References m_secondReceiveWindowFrequency, and NS_LOG_FUNCTION_NOARGS.

◆ GetSecondReceiveWindowSpreadingFactor()

uint8_t ns3::lorawan::EndDeviceStatus::GetSecondReceiveWindowSpreadingFactor ( ) const

Get the spreading factor this device is using in the second receive window.

Returns
An unsigned 8-bit integer containing the spreading factor.

Definition at line 86 of file end-device-status.cc.

References m_secondReceiveWindowSpreadingFactor, and NS_LOG_FUNCTION_NOARGS.

◆ GetTypeId()

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

Register this type.

Returns
The object TypeId.

Definition at line 32 of file end-device-status.cc.

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ HasReceiveWindowOpportunityScheduled()

bool ns3::lorawan::EndDeviceStatus::HasReceiveWindowOpportunityScheduled ( )

Check if there is already a running reception window event scheduled for this end device.

Returns
True if a reception window event is already scheduled, false otherwise.

Definition at line 359 of file end-device-status.cc.

References ns3::EventId::IsPending(), and m_receiveWindowEvent.

+ Here is the call graph for this function:

◆ InitializeReply()

void ns3::lorawan::EndDeviceStatus::InitializeReply ( )

Reset the next reply state.

Definition at line 345 of file end-device-status.cc.

References m_reply, ns3::lorawan::EndDeviceStatus::Reply::needsReply, and NS_LOG_FUNCTION_NOARGS.

◆ InsertReceivedPacket()

◆ NeedsReply()

bool ns3::lorawan::EndDeviceStatus::NeedsReply ( ) const

Whether the end device needs a reply.

This is determined by looking at headers and payload of the Reply structure: if they are empty, no reply should be needed.

Returns
A boolean value signaling if the end device needs a reply.

Definition at line 138 of file end-device-status.cc.

References m_reply, ns3::lorawan::EndDeviceStatus::Reply::needsReply, and NS_LOG_FUNCTION_NOARGS.

◆ RemoveReceiveWindowOpportunity()

void ns3::lorawan::EndDeviceStatus::RemoveReceiveWindowOpportunity ( )

Cancel next scheduled reception window event.

Definition at line 371 of file end-device-status.cc.

References ns3::Simulator::Cancel(), and m_receiveWindowEvent.

+ Here is the call graph for this function:

◆ SetFirstReceiveWindowFrequency()

void ns3::lorawan::EndDeviceStatus::SetFirstReceiveWindowFrequency ( double frequency)

Set the first window frequency of this device.

Parameters
frequencyThe frequency [MHz].

Definition at line 187 of file end-device-status.cc.

References m_firstReceiveWindowFrequency, and NS_LOG_FUNCTION_NOARGS.

Referenced by InsertReceivedPacket().

+ Here is the caller graph for this function:

◆ SetFirstReceiveWindowSpreadingFactor()

void ns3::lorawan::EndDeviceStatus::SetFirstReceiveWindowSpreadingFactor ( uint8_t sf)

Set the spreading factor this device is using in the first receive window.

Parameters
sfThe spreading factor.

Definition at line 180 of file end-device-status.cc.

References m_firstReceiveWindowSpreadingFactor, and NS_LOG_FUNCTION_NOARGS.

Referenced by InsertReceivedPacket().

+ Here is the caller graph for this function:

◆ SetReceiveWindowOpportunity()

void ns3::lorawan::EndDeviceStatus::SetReceiveWindowOpportunity ( EventId event)

Store next scheduled reception window event.

Parameters
eventThe event.

Definition at line 365 of file end-device-status.cc.

References m_receiveWindowEvent.

◆ SetReplyFrameHeader()

void ns3::lorawan::EndDeviceStatus::SetReplyFrameHeader ( LoraFrameHeader frameHeader)

Set the reply packet frame header.

Parameters
frameHeaderThe frame header (FHDR + FPort).

Definition at line 215 of file end-device-status.cc.

References ns3::lorawan::EndDeviceStatus::Reply::frameHeader, m_reply, and NS_LOG_FUNCTION_NOARGS.

◆ SetReplyMacHeader()

void ns3::lorawan::EndDeviceStatus::SetReplyMacHeader ( LorawanMacHeader macHeader)

Set the reply packet mac header.

Parameters
macHeaderThe mac header (MHDR).

Definition at line 208 of file end-device-status.cc.

References m_reply, ns3::lorawan::EndDeviceStatus::Reply::macHeader, and NS_LOG_FUNCTION_NOARGS.

◆ SetReplyPayload()

void ns3::lorawan::EndDeviceStatus::SetReplyPayload ( Ptr< Packet > replyPayload)

Set the packet reply payload.

Parameters
replyPayloadPacket containing the FRMPayload.

Definition at line 222 of file end-device-status.cc.

References m_reply, NS_LOG_FUNCTION_NOARGS, and ns3::lorawan::EndDeviceStatus::Reply::payload.

◆ SetSecondReceiveWindowFrequency()

void ns3::lorawan::EndDeviceStatus::SetSecondReceiveWindowFrequency ( double frequency)

Set the second window frequency of this device.

Parameters
frequencyThe frequency [MHz].

Definition at line 201 of file end-device-status.cc.

References m_secondReceiveWindowFrequency, and NS_LOG_FUNCTION_NOARGS.

◆ SetSecondReceiveWindowSpreadingFactor()

void ns3::lorawan::EndDeviceStatus::SetSecondReceiveWindowSpreadingFactor ( uint8_t sf)

Set the spreading factor this device is using in the second receive window.

Parameters
sfThe spreading factor.

Definition at line 194 of file end-device-status.cc.

References m_firstReceiveWindowSpreadingFactor, and NS_LOG_FUNCTION_NOARGS.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const EndDeviceStatus & status )
friend

Stream insertion operator.

Parameters
osThe stream.
statusThe status.
Returns
A reference to the stream.

Definition at line 397 of file end-device-status.cc.

Member Data Documentation

◆ m_endDeviceAddress

LoraDeviceAddress ns3::lorawan::EndDeviceStatus::m_endDeviceAddress

The address of this device.

Definition at line 346 of file end-device-status.h.

Referenced by GetCompleteReplyPacket().

◆ m_firstReceiveWindowFrequency

double ns3::lorawan::EndDeviceStatus::m_firstReceiveWindowFrequency = 0
private

Frequency [MHz] for RX1 window.

Definition at line 360 of file end-device-status.h.

Referenced by GetFirstReceiveWindowFrequency(), and SetFirstReceiveWindowFrequency().

◆ m_firstReceiveWindowSpreadingFactor

uint8_t ns3::lorawan::EndDeviceStatus::m_firstReceiveWindowSpreadingFactor = 0
private

Spreading Factor (SF) for RX1 window.

Definition at line 359 of file end-device-status.h.

Referenced by GetFirstReceiveWindowSpreadingFactor(), SetFirstReceiveWindowSpreadingFactor(), and SetSecondReceiveWindowSpreadingFactor().

◆ m_mac

Ptr<ClassAEndDeviceLorawanMac> ns3::lorawan::EndDeviceStatus::m_mac
private

Pointer to the MAC layer of this device.

Note
Using this attribute is 'cheating', since we are assuming perfect synchronization between the info at the device and at the network server

Definition at line 369 of file end-device-status.h.

Referenced by GetMac().

◆ m_receivedPacketList

ReceivedPacketList ns3::lorawan::EndDeviceStatus::m_receivedPacketList
private

◆ m_receiveWindowEvent

EventId ns3::lorawan::EndDeviceStatus::m_receiveWindowEvent
private

Event storing the next scheduled downlink transmission.

Definition at line 363 of file end-device-status.h.

Referenced by HasReceiveWindowOpportunityScheduled(), RemoveReceiveWindowOpportunity(), and SetReceiveWindowOpportunity().

◆ m_reply

struct Reply ns3::lorawan::EndDeviceStatus::m_reply

◆ m_secondReceiveWindowFrequency

double ns3::lorawan::EndDeviceStatus::m_secondReceiveWindowFrequency = 869.525
private

Frequency [MHz] for RX2 window.

Definition at line 362 of file end-device-status.h.

Referenced by GetSecondReceiveWindowFrequency(), and SetSecondReceiveWindowFrequency().

◆ m_secondReceiveWindowSpreadingFactor

uint8_t ns3::lorawan::EndDeviceStatus::m_secondReceiveWindowSpreadingFactor = 0
private

Spreading Factor (SF) for RX2 window.

Definition at line 361 of file end-device-status.h.

Referenced by GetSecondReceiveWindowSpreadingFactor().


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