Tag used to save various data about a packet, like its Spreading Factor and data about interference. More...
#include "lora-tag.h"
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. | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
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.
ns3::lorawan::LoraTag::LoraTag | ( | uint8_t | sf = 0 , |
uint8_t | destroyedBy = 0 |
||
) |
Create a LoraTag with a given spreading factor and collision.
sf | The Spreading Factor. |
destroyedBy | The spreading factor this tag's packet was destroyed by. |
Definition at line 46 of file lora-tag.cc.
|
override |
Destructor.
Definition at line 55 of file lora-tag.cc.
|
overridevirtual |
i | the 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().
uint8_t ns3::lorawan::LoraTag::GetDataRate | ( | ) | const |
Get the data rate for this packet.
Definition at line 142 of file lora-tag.cc.
References m_dataRate.
Referenced by ns3::lorawan::GatewayLorawanMac::Send().
uint8_t ns3::lorawan::LoraTag::GetDestroyedBy | ( | ) | const |
Read which Spreading Factor this packet was destroyed by.
Definition at line 100 of file lora-tag.cc.
References m_destroyedBy.
double ns3::lorawan::LoraTag::GetFrequency | ( | ) | const |
Get the frequency of the packet.
This value works in two ways:
Definition at line 136 of file lora-tag.cc.
References m_frequency.
Referenced by ns3::lorawan::EndDeviceStatus::InsertReceivedPacket(), and ns3::lorawan::GatewayLorawanMac::Send().
|
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.
Implements ns3::ObjectBase.
Definition at line 41 of file lora-tag.cc.
References GetTypeId().
double ns3::lorawan::LoraTag::GetReceivePower | ( | ) | const |
Read the power this packet arrived with.
Definition at line 106 of file lora-tag.cc.
References m_receivePower.
Referenced by ns3::lorawan::EndDeviceStatus::InsertReceivedPacket().
|
overridevirtual |
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.
uint8_t ns3::lorawan::LoraTag::GetSpreadingFactor | ( | ) | const |
Read which Spreading Factor this packet was transmitted with.
Definition at line 94 of file lora-tag.cc.
References m_sf.
Referenced by ns3::lorawan::EndDeviceStatus::InsertReceivedPacket(), OnPacketReceptionCallback(), and OnTransmissionCallback().
|
static |
Register this type.
Definition at line 33 of file lora-tag.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
overridevirtual |
os | the 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.
|
overridevirtual |
i | the 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().
void ns3::lorawan::LoraTag::SetDataRate | ( | uint8_t | dataRate | ) |
Set the data rate for this packet.
dataRate | The data rate. |
Definition at line 148 of file lora-tag.cc.
References m_dataRate.
Referenced by ns3::lorawan::NetworkStatus::GetReplyForDevice().
void ns3::lorawan::LoraTag::SetDestroyedBy | ( | uint8_t | sf | ) |
Set which Spreading Factor this packet was destroyed by.
sf | The Spreading Factor. |
Definition at line 112 of file lora-tag.cc.
References m_destroyedBy.
Referenced by ns3::lorawan::SimpleGatewayLoraPhy::EndReceive().
void ns3::lorawan::LoraTag::SetFrequency | ( | double | frequency | ) |
Set the frequency of the packet.
This value works in two ways:
frequency | The 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().
void ns3::lorawan::LoraTag::SetReceivePower | ( | double | receivePower | ) |
Set the power this packet was received with.
receivePower | The power, in dBm. |
Definition at line 124 of file lora-tag.cc.
References m_receivePower.
Referenced by ns3::lorawan::SimpleGatewayLoraPhy::EndReceive().
void ns3::lorawan::LoraTag::SetSpreadingFactor | ( | uint8_t | sf | ) |
Set which Spreading Factor this packet was transmitted with.
sf | The Spreading Factor. |
Definition at line 118 of file lora-tag.cc.
References m_sf.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::Send().
|
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().
|
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().
|
private |
The frequency of this packet.
Definition at line 148 of file lora-tag.h.
Referenced by Deserialize(), GetFrequency(), Serialize(), and SetFrequency().
|
private |
The reception power of this packet.
Definition at line 146 of file lora-tag.h.
Referenced by Deserialize(), GetReceivePower(), Print(), Serialize(), and SetReceivePower().
|
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().