This class represents the device address of a LoraWAN end device. More...
#include "lora-device-address.h"
Public Member Functions | |
LoraDeviceAddress () | |
Default constructor. | |
LoraDeviceAddress (NwkID nwkId, NwkAddr nwkAddr) | |
Build a new address from a network id and network address. | |
LoraDeviceAddress (uint32_t address) | |
Build a new address from a 32-bit integer. | |
LoraDeviceAddress (uint8_t nwkId, uint32_t nwkAddr) | |
Build a new address from a network id and network address. | |
uint32_t | Get () const |
Get the address in 32-bit integer form. | |
uint32_t | GetNwkAddr () |
Get the NwkAddr of this device. | |
uint8_t | GetNwkID () |
Get the NwkID of this device. | |
bool | operator!= (const LoraDeviceAddress &other) const |
Inequality comparison operator. | |
bool | operator< (const LoraDeviceAddress &other) const |
Less-then comparison operator. | |
bool | operator== (const LoraDeviceAddress &other) const |
Equality comparison operator. | |
bool | operator> (const LoraDeviceAddress &other) const |
Greater-then comparison operator. | |
std::string | Print () const |
Print the address bit-by-bit to a human-readable string. | |
void | Serialize (uint8_t buf[4]) const |
Convert this address to a buffer. | |
void | Set (uint32_t address) |
Set the address as a 32 bit integer. | |
void | Set (uint8_t nwkId, uint32_t nwkAddr) |
Set the address, combining a network id and a network address. | |
void | SetNwkAddr (uint32_t nwkAddr) |
Set the NwkAddr of this device. | |
void | SetNwkID (uint8_t nwkId) |
Set the NwkID of this device. | |
Static Public Member Functions | |
static LoraDeviceAddress | ConvertFrom (const Address &address) |
Convert from an ordinary address to a LoraDeviceAddress instance. | |
static LoraDeviceAddress | Deserialize (const uint8_t buf[4]) |
Convert the input buffer into a new address. | |
Private Member Functions | |
Address | ConvertTo () const |
Convert this instance of LoraDeviceAddress to an Address. | |
Static Private Member Functions | |
static uint8_t | GetType () |
Get a new address type id. | |
Private Attributes | |
NwkAddr | m_nwkAddr |
The network address of this address. | |
NwkID | m_nwkId |
The network Id of this address. | |
This class represents the device address of a LoraWAN end device.
Definition at line 105 of file lora-device-address.h.
ns3::lorawan::LoraDeviceAddress::LoraDeviceAddress | ( | ) |
Default constructor.
Definition at line 77 of file lora-device-address.cc.
References NS_LOG_FUNCTION_NOARGS.
Referenced by ConvertFrom(), Deserialize(), operator!=(), operator<(), operator==(), operator>(), and Set().
ns3::lorawan::LoraDeviceAddress::LoraDeviceAddress | ( | uint32_t | address | ) |
Build a new address from a 32-bit integer.
address | Full numeric value of the address. |
Definition at line 82 of file lora-device-address.cc.
References NS_LOG_FUNCTION, and Set().
ns3::lorawan::LoraDeviceAddress::LoraDeviceAddress | ( | uint8_t | nwkId, |
uint32_t | nwkAddr ) |
Build a new address from a network id and network address.
nwkId | Network id numeric value. |
nwkAddr | Network address numeric value. |
Definition at line 89 of file lora-device-address.cc.
References m_nwkAddr, m_nwkId, and NS_LOG_FUNCTION.
Build a new address from a network id and network address.
nwkId | Network id object. |
nwkAddr | Network address object. |
Definition at line 97 of file lora-device-address.cc.
References ns3::lorawan::NwkAddr::Get(), ns3::lorawan::NwkID::Get(), m_nwkAddr, m_nwkId, and NS_LOG_FUNCTION.
|
static |
Convert from an ordinary address to a LoraDeviceAddress instance.
address | Reference to ordinary Address object. |
Definition at line 147 of file lora-device-address.cc.
References LoraDeviceAddress(), Deserialize(), GetType(), and NS_ASSERT.
|
private |
Convert this instance of LoraDeviceAddress to an Address.
Definition at line 137 of file lora-device-address.cc.
References GetType(), NS_LOG_FUNCTION, and Serialize().
|
static |
Convert the input buffer into a new address.
buf | [in] buffer containing serialized address. |
Definition at line 119 of file lora-device-address.cc.
References LoraDeviceAddress(), and NS_LOG_FUNCTION.
Referenced by ConvertFrom(), and AddressTest::DoRun().
uint32_t ns3::lorawan::LoraDeviceAddress::Get | ( | ) | const |
Get the address in 32-bit integer form.
Definition at line 171 of file lora-device-address.cc.
References m_nwkAddr, m_nwkId, NS_LOG_DEBUG, and NS_LOG_FUNCTION_NOARGS.
Referenced by operator!=(), operator<(), operator==(), operator>(), and Serialize().
uint32_t ns3::lorawan::LoraDeviceAddress::GetNwkAddr | ( | ) |
Get the NwkAddr of this device.
Definition at line 201 of file lora-device-address.cc.
References m_nwkAddr, and NS_LOG_FUNCTION_NOARGS.
uint8_t ns3::lorawan::LoraDeviceAddress::GetNwkID | ( | ) |
Get the NwkID of this device.
Definition at line 193 of file lora-device-address.cc.
References m_nwkId, and NS_LOG_FUNCTION_NOARGS.
|
staticprivate |
Get a new address type id.
Definition at line 162 of file lora-device-address.cc.
References NS_LOG_FUNCTION_NOARGS, and ns3::Address::Register().
Referenced by ConvertFrom(), and ConvertTo().
bool ns3::lorawan::LoraDeviceAddress::operator!= | ( | const LoraDeviceAddress & | other | ) | const |
Inequality comparison operator.
other | Address to compare. |
Definition at line 243 of file lora-device-address.cc.
References LoraDeviceAddress(), and Get().
bool ns3::lorawan::LoraDeviceAddress::operator< | ( | const LoraDeviceAddress & | other | ) | const |
Less-then comparison operator.
other | Address to compare. |
Definition at line 248 of file lora-device-address.cc.
References LoraDeviceAddress(), and Get().
bool ns3::lorawan::LoraDeviceAddress::operator== | ( | const LoraDeviceAddress & | other | ) | const |
Equality comparison operator.
other | Address to compare. |
Definition at line 237 of file lora-device-address.cc.
References LoraDeviceAddress(), and Get().
bool ns3::lorawan::LoraDeviceAddress::operator> | ( | const LoraDeviceAddress & | other | ) | const |
Greater-then comparison operator.
other | Address to compare. |
Definition at line 255 of file lora-device-address.cc.
References LoraDeviceAddress(), and Get().
std::string ns3::lorawan::LoraDeviceAddress::Print | ( | ) | const |
Print the address bit-by-bit to a human-readable string.
Definition at line 225 of file lora-device-address.cc.
References m_nwkAddr, m_nwkId, and NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::lorawan::NetworkStatus::AddNode().
void ns3::lorawan::LoraDeviceAddress::Serialize | ( | uint8_t | buf[4] | ) | const |
Convert this address to a buffer.
buf | [out] buffer to fill with serialized address. |
Definition at line 106 of file lora-device-address.cc.
References Get(), and NS_LOG_FUNCTION.
Referenced by ConvertTo(), and AddressTest::DoRun().
void ns3::lorawan::LoraDeviceAddress::Set | ( | uint32_t | address | ) |
Set the address as a 32 bit integer.
address | Full numeric value of the address. |
Definition at line 184 of file lora-device-address.cc.
References m_nwkAddr, m_nwkId, and NS_LOG_FUNCTION_NOARGS.
Referenced by LoraDeviceAddress().
void ns3::lorawan::LoraDeviceAddress::Set | ( | uint8_t | nwkId, |
uint32_t | nwkAddr ) |
Set the address, combining a network id and a network address.
Note that nwkId is 7 bits long, and this function expects the 7 least significant bits to contain the nwkId. Similarly for the nwkAddr, the 25 least significant bits of the uint32 are those that are expected to contain the nwkAddr.
nwkId | Network id numeric value. |
nwkAddr | Network address numeric value. |
References LoraDeviceAddress().
void ns3::lorawan::LoraDeviceAddress::SetNwkAddr | ( | uint32_t | nwkAddr | ) |
Set the NwkAddr of this device.
nwkAddr | The network address to set. |
Definition at line 217 of file lora-device-address.cc.
References m_nwkAddr, and NS_LOG_FUNCTION.
void ns3::lorawan::LoraDeviceAddress::SetNwkID | ( | uint8_t | nwkId | ) |
Set the NwkID of this device.
nwkId | The network id to set. |
Definition at line 209 of file lora-device-address.cc.
References m_nwkId, and NS_LOG_FUNCTION.
|
private |
The network address of this address.
Definition at line 272 of file lora-device-address.h.
Referenced by LoraDeviceAddress(), LoraDeviceAddress(), Get(), GetNwkAddr(), Print(), Set(), and SetNwkAddr().
|
private |
The network Id of this address.
Definition at line 271 of file lora-device-address.h.
Referenced by LoraDeviceAddress(), LoraDeviceAddress(), Get(), GetNwkID(), Print(), Set(), and SetNwkID().