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

Tag used to save various data about a packet, like its Spreading Factor and data about interference. More...

#include "lora-tag.h"

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

Public Member Functions

 LoraTag (uint8_t sf=0, uint8_t destroyedBy=0)
 Create a LoraTag with a given spreading factor and collision.
 
 ~LoraTag () override
 Destructor.
 
void Deserialize (TagBuffer i) override
 
uint8_t GetDataRate () const
 Get the data rate for this packet.
 
uint8_t GetDestroyedBy () const
 Read which Spreading Factor this packet was destroyed by.
 
double GetFrequency () const
 Get the frequency of the packet.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
double GetReceivePower () const
 Read the power this packet arrived with.
 
uint32_t GetSerializedSize () const override
 
uint8_t GetSpreadingFactor () const
 Read which Spreading Factor this packet was transmitted with.
 
void Print (std::ostream &os) const override
 
void Serialize (TagBuffer i) const override
 
void SetDataRate (uint8_t dataRate)
 Set the data rate for this packet.
 
void SetDestroyedBy (uint8_t sf)
 Set which Spreading Factor this packet was destroyed by.
 
void SetFrequency (double frequency)
 Set the frequency of the packet.
 
void SetReceivePower (double receivePower)
 Set the power this packet was received with.
 
void SetSpreadingFactor (uint8_t sf)
 Set which Spreading Factor this packet was transmitted with.
 
virtual void Deserialize (TagBuffer i)=0
 
virtual uint32_t GetSerializedSize () const =0
 
virtual void Print (std::ostream &os) const =0
 
virtual void Serialize (TagBuffer i) const =0
 
- 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::Tag
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Private Attributes

uint8_t m_dataRate
 The data rate that needs to be used to send this packet.
 
uint8_t m_destroyedBy
 The Spreading Factor that destroyed the packet.
 
double m_frequency
 The frequency of this packet.
 
double m_receivePower
 The reception power of this packet.
 
uint8_t m_sf
 The Spreading Factor used by the packet.
 

Additional Inherited Members

- 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

Tag used to save various data about a packet, like its Spreading Factor and data about interference.

Definition at line 36 of file lora-tag.h.

Constructor & Destructor Documentation

◆ LoraTag()

ns3::lorawan::LoraTag::LoraTag ( uint8_t  sf = 0,
uint8_t  destroyedBy = 0 
)

Create a LoraTag with a given spreading factor and collision.

Parameters
sfThe Spreading Factor.
destroyedByThe spreading factor this tag's packet was destroyed by.

Definition at line 46 of file lora-tag.cc.

◆ ~LoraTag()

ns3::lorawan::LoraTag::~LoraTag ( )
override

Destructor.

Definition at line 55 of file lora-tag.cc.

Member Function Documentation

◆ Deserialize()

void ns3::lorawan::LoraTag::Deserialize ( TagBuffer  i)
overridevirtual
Parameters
ithe buffer to read data from.

Read the content of the tag from the provided tag buffer. DO NOT attempt to read more bytes than you wrote with Tag::Serialize.

Implements ns3::Tag.

Definition at line 78 of file lora-tag.cc.

References m_dataRate, m_destroyedBy, m_frequency, m_receivePower, m_sf, ns3::TagBuffer::ReadDouble(), and ns3::TagBuffer::ReadU8().

+ Here is the call graph for this function:

◆ GetDataRate()

uint8_t ns3::lorawan::LoraTag::GetDataRate ( ) const

Get the data rate for this packet.

Returns
The data rate that needs to be employed for this packet.

Definition at line 142 of file lora-tag.cc.

References m_dataRate.

Referenced by ns3::lorawan::GatewayLorawanMac::Send().

+ Here is the caller graph for this function:

◆ GetDestroyedBy()

uint8_t ns3::lorawan::LoraTag::GetDestroyedBy ( ) const

Read which Spreading Factor this packet was destroyed by.

Returns
The spreading factor this packet was destroyed by.

Definition at line 100 of file lora-tag.cc.

References m_destroyedBy.

◆ GetFrequency()

double ns3::lorawan::LoraTag::GetFrequency ( ) const

Get the frequency of the packet.

This value works in two ways:

  • It is used by the gateway to signal to the network server the frequency of the uplink packet
  • It is used by the network server to signal to the gateway the frequency of a downlink packet.
Returns
The frequency value [MHz].

Definition at line 136 of file lora-tag.cc.

References m_frequency.

Referenced by ns3::lorawan::EndDeviceStatus::InsertReceivedPacket(), and ns3::lorawan::GatewayLorawanMac::Send().

+ Here is the caller graph for this function:

◆ GetInstanceTypeId()

TypeId ns3::lorawan::LoraTag::GetInstanceTypeId ( ) const
overridevirtual

Get the most derived TypeId for this Object.

This method is typically implemented by ns3::Object::GetInstanceTypeId but some classes which derive from ns3::ObjectBase directly have to implement it themselves.

Returns
The TypeId associated to the most-derived type of this instance.

Implements ns3::ObjectBase.

Definition at line 41 of file lora-tag.cc.

References GetTypeId().

+ Here is the call graph for this function:

◆ GetReceivePower()

double ns3::lorawan::LoraTag::GetReceivePower ( ) const

Read the power this packet arrived with.

Returns
This tag's packet received power.

Definition at line 106 of file lora-tag.cc.

References m_receivePower.

Referenced by ns3::lorawan::EndDeviceStatus::InsertReceivedPacket().

+ Here is the caller graph for this function:

◆ GetSerializedSize()

uint32_t ns3::lorawan::LoraTag::GetSerializedSize ( ) const
overridevirtual
Returns
the number of bytes required to serialize the data of the tag.

This method is typically invoked by Packet::AddPacketTag or Packet::AddByteTag just prior to calling Tag::Serialize.

Implements ns3::Tag.

Definition at line 60 of file lora-tag.cc.

◆ GetSpreadingFactor()

uint8_t ns3::lorawan::LoraTag::GetSpreadingFactor ( ) const

Read which Spreading Factor this packet was transmitted with.

Returns
This tag's packet's spreading factor.

Definition at line 94 of file lora-tag.cc.

References m_sf.

Referenced by ns3::lorawan::EndDeviceStatus::InsertReceivedPacket(), OnPacketReceptionCallback(), and OnTransmissionCallback().

+ Here is the caller graph for this function:

◆ GetTypeId()

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

Register this type.

Returns
The object TypeId.

Definition at line 33 of file lora-tag.cc.

References ns3::TypeId::SetParent().

Referenced by GetInstanceTypeId().

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

◆ Print()

void ns3::lorawan::LoraTag::Print ( std::ostream &  os) const
overridevirtual
Parameters
osthe stream to print to

This method is typically invoked from the Packet::PrintByteTags or Packet::PrintPacketTags methods.

Implements ns3::Tag.

Definition at line 88 of file lora-tag.cc.

References m_dataRate, m_destroyedBy, m_receivePower, and m_sf.

◆ Serialize()

void ns3::lorawan::LoraTag::Serialize ( TagBuffer  i) const
overridevirtual
Parameters
ithe buffer to write data into.

Write the content of the tag in the provided tag buffer. DO NOT attempt to write more bytes than you requested with Tag::GetSerializedSize.

Implements ns3::Tag.

Definition at line 68 of file lora-tag.cc.

References m_dataRate, m_destroyedBy, m_frequency, m_receivePower, m_sf, ns3::TagBuffer::WriteDouble(), and ns3::TagBuffer::WriteU8().

+ Here is the call graph for this function:

◆ SetDataRate()

void ns3::lorawan::LoraTag::SetDataRate ( uint8_t  dataRate)

Set the data rate for this packet.

Parameters
dataRateThe data rate.

Definition at line 148 of file lora-tag.cc.

References m_dataRate.

Referenced by ns3::lorawan::NetworkStatus::GetReplyForDevice().

+ Here is the caller graph for this function:

◆ SetDestroyedBy()

void ns3::lorawan::LoraTag::SetDestroyedBy ( uint8_t  sf)

Set which Spreading Factor this packet was destroyed by.

Parameters
sfThe Spreading Factor.

Definition at line 112 of file lora-tag.cc.

References m_destroyedBy.

Referenced by ns3::lorawan::SimpleGatewayLoraPhy::EndReceive().

+ Here is the caller graph for this function:

◆ SetFrequency()

void ns3::lorawan::LoraTag::SetFrequency ( double  frequency)

Set the frequency of the packet.

This value works in two ways:

  • It is used by the gateway to signal to the network server the frequency of the uplink packet
  • It is used by the network server to signal to the gateway the frequency of a downlink packet.
Parameters
frequencyThe frequency value [MHz].

Definition at line 130 of file lora-tag.cc.

References m_frequency.

Referenced by ns3::lorawan::SimpleGatewayLoraPhy::EndReceive(), and ns3::lorawan::NetworkStatus::GetReplyForDevice().

+ Here is the caller graph for this function:

◆ SetReceivePower()

void ns3::lorawan::LoraTag::SetReceivePower ( double  receivePower)

Set the power this packet was received with.

Parameters
receivePowerThe power, in dBm.

Definition at line 124 of file lora-tag.cc.

References m_receivePower.

Referenced by ns3::lorawan::SimpleGatewayLoraPhy::EndReceive().

+ Here is the caller graph for this function:

◆ SetSpreadingFactor()

void ns3::lorawan::LoraTag::SetSpreadingFactor ( uint8_t  sf)

Set which Spreading Factor this packet was transmitted with.

Parameters
sfThe Spreading Factor.

Definition at line 118 of file lora-tag.cc.

References m_sf.

Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::Send().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_dataRate

uint8_t ns3::lorawan::LoraTag::m_dataRate
private

The data rate that needs to be used to send this packet.

Definition at line 147 of file lora-tag.h.

Referenced by Deserialize(), GetDataRate(), Print(), Serialize(), and SetDataRate().

◆ m_destroyedBy

uint8_t ns3::lorawan::LoraTag::m_destroyedBy
private

The Spreading Factor that destroyed the packet.

Definition at line 145 of file lora-tag.h.

Referenced by Deserialize(), GetDestroyedBy(), Print(), Serialize(), and SetDestroyedBy().

◆ m_frequency

double ns3::lorawan::LoraTag::m_frequency
private

The frequency of this packet.

Definition at line 148 of file lora-tag.h.

Referenced by Deserialize(), GetFrequency(), Serialize(), and SetFrequency().

◆ m_receivePower

double ns3::lorawan::LoraTag::m_receivePower
private

The reception power of this packet.

Definition at line 146 of file lora-tag.h.

Referenced by Deserialize(), GetReceivePower(), Print(), Serialize(), and SetReceivePower().

◆ m_sf

uint8_t ns3::lorawan::LoraTag::m_sf
private

The Spreading Factor used by the packet.

Definition at line 144 of file lora-tag.h.

Referenced by Deserialize(), GetSpreadingFactor(), Print(), Serialize(), and SetSpreadingFactor().


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