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

This class represents the knowledge about the state of the network that is available at the network server. More...

#include "network-status.h"

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

Public Member Functions

 NetworkStatus ()
 Default constructor.
 
 ~NetworkStatus () override
 Destructor.
 
void AddGateway (Address &address, Ptr< GatewayStatus > gwStatus)
 Add a new gateway to the list of gateways connected to the network.
 
void AddNode (Ptr< ClassAEndDeviceLorawanMac > edMac)
 Add a device to the ones that are tracked by this NetworkStatus object.
 
int CountEndDevices ()
 Return the number of end devices currently managed by the server.
 
Address GetBestGatewayForDevice (LoraDeviceAddress deviceAddress, int window)
 Return whether we have a gateway that is available to send a reply to the specified device.
 
Ptr< EndDeviceStatusGetEndDeviceStatus (LoraDeviceAddress address)
 Get the EndDeviceStatus corresponding to a LoraDeviceAddress.
 
Ptr< EndDeviceStatusGetEndDeviceStatus (Ptr< const Packet > packet)
 Get the EndDeviceStatus of the device that sent a packet.
 
Ptr< PacketGetReplyForDevice (LoraDeviceAddress edAddress, int windowNumber)
 Get the reply packet prepared for a reception window of a device.
 
bool NeedsReply (LoraDeviceAddress deviceAddress)
 Return whether the specified device needs a reply.
 
void OnReceivedPacket (Ptr< const Packet > packet, const Address &gwaddress)
 Update network status on a received packet.
 
void SendThroughGateway (Ptr< Packet > packet, Address gwAddress)
 Send a packet through a gateway.
 
- 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::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Public Attributes

std::map< LoraDeviceAddress, Ptr< EndDeviceStatus > > m_endDeviceStatuses
 Map tracking the state of devices connected to this network server.
 
std::map< Address, Ptr< GatewayStatus > > m_gatewayStatuses
 Map tracking the state of gateways connected to this network server.
 

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 knowledge about the state of the network that is available at the network server.

It is essentially a collection of two maps: one containing DeviceStatus objects, and the other containing GatewayStatus objects.

This class is meant to be queried by NetworkController components, which can decide to take action based on the current status of the network.

Definition at line 48 of file network-status.h.

Constructor & Destructor Documentation

◆ NetworkStatus()

ns3::lorawan::NetworkStatus::NetworkStatus ( )

Default constructor.

Definition at line 52 of file network-status.cc.

References NS_LOG_FUNCTION_NOARGS.

◆ ~NetworkStatus()

ns3::lorawan::NetworkStatus::~NetworkStatus ( )
override

Destructor.

Definition at line 57 of file network-status.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

◆ AddGateway()

void ns3::lorawan::NetworkStatus::AddGateway ( Address address,
Ptr< GatewayStatus gwStatus 
)

Add a new gateway to the list of gateways connected to the network.

Each gateway is identified by its NetDevice Address in the network connecting it to the network server.

Parameters
addressThe gateway's NetDevice Address.
gwStatusA pointer to a GatewayStatus object for the gateway.

Definition at line 83 of file network-status.cc.

References m_gatewayStatuses, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

◆ AddNode()

void ns3::lorawan::NetworkStatus::AddNode ( Ptr< ClassAEndDeviceLorawanMac edMac)

Add a device to the ones that are tracked by this NetworkStatus object.

Parameters
edMacPointer to the MAC layer object of the device to be tracked.

Definition at line 63 of file network-status.cc.

References m_endDeviceStatuses, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::lorawan::LoraDeviceAddress::Print().

Referenced by NetworkStatusTest::DoRun().

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

◆ CountEndDevices()

int ns3::lorawan::NetworkStatus::CountEndDevices ( )

Return the number of end devices currently managed by the server.

Returns
The number of end devices as an int.

Definition at line 243 of file network-status.cc.

References m_endDeviceStatuses, and NS_LOG_FUNCTION.

◆ GetBestGatewayForDevice()

Address ns3::lorawan::NetworkStatus::GetBestGatewayForDevice ( LoraDeviceAddress  deviceAddress,
int  window 
)

Return whether we have a gateway that is available to send a reply to the specified device.

Parameters
deviceAddressThe address of the device we are interested in.
windowThe device reception window we are currently targeting (1 or 2).
Returns
The Address of the gateway which measured the best RSSI of the last packet from the device, selected among the gateways being currently available for downlink transmission.

Definition at line 127 of file network-status.cc.

References m_endDeviceStatuses, m_gatewayStatuses, and NS_ABORT_MSG.

◆ GetEndDeviceStatus() [1/2]

Ptr< EndDeviceStatus > ns3::lorawan::NetworkStatus::GetEndDeviceStatus ( LoraDeviceAddress  address)

Get the EndDeviceStatus corresponding to a LoraDeviceAddress.

Parameters
addressThe LoraDeviceAddress of the end device.
Returns
A pointer to the end device status.

Definition at line 226 of file network-status.cc.

References m_endDeviceStatuses, NS_LOG_ERROR, and NS_LOG_FUNCTION.

◆ GetEndDeviceStatus() [2/2]

Ptr< EndDeviceStatus > ns3::lorawan::NetworkStatus::GetEndDeviceStatus ( Ptr< const Packet packet)

Get the EndDeviceStatus of the device that sent a packet.

Parameters
packetThe packet sent by the end device.
Returns
A pointer to the end device status.

Definition at line 203 of file network-status.cc.

References ns3::lorawan::LoraFrameHeader::GetAddress(), m_endDeviceStatuses, NS_LOG_ERROR, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetReplyForDevice()

Ptr< Packet > ns3::lorawan::NetworkStatus::GetReplyForDevice ( LoraDeviceAddress  edAddress,
int  windowNumber 
)

Get the reply packet prepared for a reception window of a device.

Parameters
edAddressThe address of the device.
windowNumberThe reception window number (1 or 2).
Returns
The reply packet.

Definition at line 178 of file network-status.cc.

References m_endDeviceStatuses, ns3::lorawan::LoraTag::SetDataRate(), and ns3::lorawan::LoraTag::SetFrequency().

+ Here is the call graph for this function:

◆ GetTypeId()

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

Register this type.

Returns
The object TypeId.

Definition at line 43 of file network-status.cc.

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ NeedsReply()

bool ns3::lorawan::NetworkStatus::NeedsReply ( LoraDeviceAddress  deviceAddress)

Return whether the specified device needs a reply.

Parameters
deviceAddressThe address of the device we are interested in.
Returns
True if we need to reply to the last packet from the device, false otherwise.

Definition at line 120 of file network-status.cc.

References m_endDeviceStatuses.

◆ OnReceivedPacket()

void ns3::lorawan::NetworkStatus::OnReceivedPacket ( Ptr< const Packet packet,
const Address gwaddress 
)

Update network status on a received packet.

Parameters
packetThe received packet.
gwaddressAddress of the gateway this packet was received from.

Definition at line 99 of file network-status.cc.

References ns3::lorawan::LoraFrameHeader::GetAddress(), m_endDeviceStatuses, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::lorawan::LoraFrameHeader::SetAsUplink().

+ Here is the call graph for this function:

◆ SendThroughGateway()

void ns3::lorawan::NetworkStatus::SendThroughGateway ( Ptr< Packet packet,
Address  gwAddress 
)

Send a packet through a gateway.

This function assumes that the packet is already tagged with a LoraTag that will inform the gateway of the parameters to use for the transmission.

Parameters
packetThe packet.
gwAddressThe address of the gateway.

Definition at line 170 of file network-status.cc.

References m_gatewayStatuses, and NS_LOG_FUNCTION.

Member Data Documentation

◆ m_endDeviceStatuses

std::map<LoraDeviceAddress, Ptr<EndDeviceStatus> > ns3::lorawan::NetworkStatus::m_endDeviceStatuses

Map tracking the state of devices connected to this network server.

Definition at line 151 of file network-status.h.

Referenced by AddNode(), CountEndDevices(), GetBestGatewayForDevice(), GetEndDeviceStatus(), GetReplyForDevice(), NeedsReply(), and OnReceivedPacket().

◆ m_gatewayStatuses

std::map<Address, Ptr<GatewayStatus> > ns3::lorawan::NetworkStatus::m_gatewayStatuses

Map tracking the state of gateways connected to this network server.

Definition at line 153 of file network-status.h.

Referenced by AddGateway(), GetBestGatewayForDevice(), and SendThroughGateway().


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