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. | |
uint32_t | 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 (uint32_t frequencyHz) |
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 | ~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 TypeId | GetTypeId () |
Get the type ID. | |
![]() | |
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. | |
uint32_t | m_frequencyHz |
The frequency [Hz] 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 | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
![]() | |
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 25 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 35 of file lora-tag.cc.
References m_dataRate, m_destroyedBy, m_frequencyHz, m_receivePower, and m_sf.
Referenced by GetTypeId().
|
override |
Destructor.
Definition at line 44 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 67 of file lora-tag.cc.
References m_dataRate, m_destroyedBy, m_frequencyHz, m_receivePower, m_sf, ns3::TagBuffer::ReadDouble(), ns3::TagBuffer::ReadU32(), and ns3::TagBuffer::ReadU8().
uint8_t ns3::lorawan::LoraTag::GetDataRate | ( | ) | const |
Get the data rate for this packet.
Definition at line 131 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 89 of file lora-tag.cc.
References m_destroyedBy.
uint32_t ns3::lorawan::LoraTag::GetFrequency | ( | ) | const |
Get the frequency of the packet.
This value works in two ways:
Definition at line 125 of file lora-tag.cc.
References m_frequencyHz.
Referenced by ns3::lorawan::EndDeviceStatus::InsertReceivedPacket(), and ns3::lorawan::GatewayLorawanMac::Send().
|
overridevirtual |
Get the most derived TypeId for this Object.
This method is provided by ns3::Object::GetInstanceTypeId but classes which derive from ns3::ObjectBase directly have to implement it themselves. Typically, this method should simply return the output of GetTypeId()
.
Implements ns3::ObjectBase.
Definition at line 30 of file lora-tag.cc.
References GetTypeId().
double ns3::lorawan::LoraTag::GetReceivePower | ( | ) | const |
Read the power this packet arrived with.
Definition at line 95 of file lora-tag.cc.
References m_receivePower.
Referenced by ns3::lorawan::EndDeviceStatus::InsertReceivedPacket(), and ns3::lorawan::ClassAEndDeviceLorawanMac::Receive().
|
overridevirtual |
This method is typically invoked by Packet::AddPacketTag or Packet::AddByteTag just prior to calling Tag::Serialize.
Implements ns3::Tag.
Definition at line 49 of file lora-tag.cc.
uint8_t ns3::lorawan::LoraTag::GetSpreadingFactor | ( | ) | const |
Read which Spreading Factor this packet was transmitted with.
Definition at line 83 of file lora-tag.cc.
References m_sf.
Referenced by ns3::lorawan::EndDeviceStatus::InsertReceivedPacket(), OnPacketReceptionCallback(), and OnTransmissionCallback().
|
static |
Register this type.
Definition at line 22 of file lora-tag.cc.
References LoraTag(), and 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 77 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 57 of file lora-tag.cc.
References m_dataRate, m_destroyedBy, m_frequencyHz, m_receivePower, m_sf, ns3::TagBuffer::WriteDouble(), ns3::TagBuffer::WriteU32(), 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 137 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 101 of file lora-tag.cc.
References m_destroyedBy.
Referenced by ns3::lorawan::SimpleGatewayLoraPhy::EndReceive().
void ns3::lorawan::LoraTag::SetFrequency | ( | uint32_t | frequencyHz | ) |
Set the frequency of the packet.
This value works in two ways:
frequencyHz | The frequency value [Hz]. |
Definition at line 119 of file lora-tag.cc.
References m_frequencyHz.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), 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 113 of file lora-tag.cc.
References m_receivePower.
Referenced by ns3::lorawan::SimpleEndDeviceLoraPhy::EndReceive(), and 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 107 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 136 of file lora-tag.h.
Referenced by LoraTag(), Deserialize(), GetDataRate(), Print(), Serialize(), and SetDataRate().
|
private |
The Spreading Factor that destroyed the packet.
Definition at line 134 of file lora-tag.h.
Referenced by LoraTag(), Deserialize(), GetDestroyedBy(), Print(), Serialize(), and SetDestroyedBy().
|
private |
The frequency [Hz] of this packet.
Definition at line 137 of file lora-tag.h.
Referenced by LoraTag(), Deserialize(), GetFrequency(), Serialize(), and SetFrequency().
|
private |
The reception power of this packet.
Definition at line 135 of file lora-tag.h.
Referenced by LoraTag(), Deserialize(), GetReceivePower(), Print(), Serialize(), and SetReceivePower().
|
private |
The Spreading Factor used by the packet.
Definition at line 133 of file lora-tag.h.
Referenced by LoraTag(), Deserialize(), GetSpreadingFactor(), Print(), Serialize(), and SetSpreadingFactor().