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

This class represents the device address of a LoraWAN end device. More...

#include "lora-device-address.h"

+ Collaboration diagram for ns3::lorawan::LoraDeviceAddress:

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.
 

Detailed Description

This class represents the device address of a LoraWAN end device.

Definition at line 116 of file lora-device-address.h.

Constructor & Destructor Documentation

◆ LoraDeviceAddress() [1/4]

ns3::lorawan::LoraDeviceAddress::LoraDeviceAddress ( )

Default constructor.

Definition at line 88 of file lora-device-address.cc.

References NS_LOG_FUNCTION_NOARGS.

Referenced by Deserialize().

+ Here is the caller graph for this function:

◆ LoraDeviceAddress() [2/4]

ns3::lorawan::LoraDeviceAddress::LoraDeviceAddress ( uint32_t  address)

Build a new address from a 32-bit integer.

Parameters
addressFull numeric value of the address.

Definition at line 93 of file lora-device-address.cc.

References NS_LOG_FUNCTION, and Set().

+ Here is the call graph for this function:

◆ LoraDeviceAddress() [3/4]

ns3::lorawan::LoraDeviceAddress::LoraDeviceAddress ( uint8_t  nwkId,
uint32_t  nwkAddr 
)

Build a new address from a network id and network address.

Parameters
nwkIdNetwork id numeric value.
nwkAddrNetwork address numeric value.

Definition at line 100 of file lora-device-address.cc.

References m_nwkAddr, m_nwkId, NS_LOG_FUNCTION, ns3::lorawan::NwkAddr::Set(), and ns3::lorawan::NwkID::Set().

+ Here is the call graph for this function:

◆ LoraDeviceAddress() [4/4]

ns3::lorawan::LoraDeviceAddress::LoraDeviceAddress ( NwkID  nwkId,
NwkAddr  nwkAddr 
)

Build a new address from a network id and network address.

Parameters
nwkIdNetwork id object.
nwkAddrNetwork address object.

Definition at line 108 of file lora-device-address.cc.

References ns3::lorawan::NwkID::Get(), ns3::lorawan::NwkAddr::Get(), m_nwkAddr, m_nwkId, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Member Function Documentation

◆ ConvertFrom()

LoraDeviceAddress ns3::lorawan::LoraDeviceAddress::ConvertFrom ( const Address address)
static

Convert from an ordinary address to a LoraDeviceAddress instance.

Parameters
addressReference to ordinary Address object.
Returns
The LoraDeviceAddress object.

Definition at line 158 of file lora-device-address.cc.

References Deserialize(), GetType(), and NS_ASSERT.

+ Here is the call graph for this function:

◆ ConvertTo()

Address ns3::lorawan::LoraDeviceAddress::ConvertTo ( ) const
private

Convert this instance of LoraDeviceAddress to an Address.

Returns
The Address object.

Definition at line 148 of file lora-device-address.cc.

References GetType(), NS_LOG_FUNCTION, and Serialize().

+ Here is the call graph for this function:

◆ Deserialize()

LoraDeviceAddress ns3::lorawan::LoraDeviceAddress::Deserialize ( const uint8_t  buf[4])
static

Convert the input buffer into a new address.

Parameters
buf[in] buffer containing serialized address.
Returns
The LoraDeviceAddress object.

Definition at line 130 of file lora-device-address.cc.

References LoraDeviceAddress(), and NS_LOG_FUNCTION.

Referenced by ConvertFrom(), and AddressTest::DoRun().

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

◆ Get()

uint32_t ns3::lorawan::LoraDeviceAddress::Get ( ) const

Get the address in 32-bit integer form.

Returns
Full numeric value of the address.

Definition at line 182 of file lora-device-address.cc.

References ns3::lorawan::NwkID::Get(), ns3::lorawan::NwkAddr::Get(), m_nwkAddr, m_nwkId, NS_LOG_DEBUG, and NS_LOG_FUNCTION_NOARGS.

Referenced by operator!=(), operator<(), operator==(), operator>(), ns3::lorawan::LoraFrameHeader::Serialize(), and Serialize().

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

◆ GetNwkAddr()

uint32_t ns3::lorawan::LoraDeviceAddress::GetNwkAddr ( )

Get the NwkAddr of this device.

Remarks
The NwkAddr will be contained on the 25 least significant bits of the uint32_t.
Returns
A 32-bit representation of the Network Address of this Device Address.

Definition at line 212 of file lora-device-address.cc.

References ns3::lorawan::NwkAddr::Get(), m_nwkAddr, and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

◆ GetNwkID()

uint8_t ns3::lorawan::LoraDeviceAddress::GetNwkID ( )

Get the NwkID of this device.

Remarks
The NwkID bit-by-bit representation will be contained in the 7 least significant bits of the returned uint8_t.
Returns
An 8-bit representation of the Network Id of this Device Address.

Definition at line 204 of file lora-device-address.cc.

References ns3::lorawan::NwkID::Get(), m_nwkId, and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

◆ GetType()

uint8_t ns3::lorawan::LoraDeviceAddress::GetType ( )
staticprivate

Get a new address type id.

Returns
The new address type id.

Definition at line 173 of file lora-device-address.cc.

References NS_LOG_FUNCTION_NOARGS, and ns3::Address::Register().

Referenced by ConvertFrom(), and ConvertTo().

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

◆ operator!=()

bool ns3::lorawan::LoraDeviceAddress::operator!= ( const LoraDeviceAddress other) const

Inequality comparison operator.

Parameters
otherAddress to compare.
Returns
True if the addresses are different.

Definition at line 254 of file lora-device-address.cc.

References Get().

+ Here is the call graph for this function:

◆ operator<()

bool ns3::lorawan::LoraDeviceAddress::operator< ( const LoraDeviceAddress other) const

Less-then comparison operator.

Parameters
otherAddress to compare.
Returns
True if the first address is less than the second.

Definition at line 259 of file lora-device-address.cc.

References Get().

+ Here is the call graph for this function:

◆ operator==()

bool ns3::lorawan::LoraDeviceAddress::operator== ( const LoraDeviceAddress other) const

Equality comparison operator.

Parameters
otherAddress to compare.
Returns
True if the addresses are equal.

Definition at line 248 of file lora-device-address.cc.

References Get().

+ Here is the call graph for this function:

◆ operator>()

bool ns3::lorawan::LoraDeviceAddress::operator> ( const LoraDeviceAddress other) const

Greater-then comparison operator.

Parameters
otherAddress to compare.
Returns
True if the first address is greater than the second.

Definition at line 266 of file lora-device-address.cc.

References Get().

+ Here is the call graph for this function:

◆ Print()

std::string ns3::lorawan::LoraDeviceAddress::Print ( ) const

Print the address bit-by-bit to a human-readable string.

Returns
The string containing the network address.

Definition at line 236 of file lora-device-address.cc.

References ns3::lorawan::NwkID::Get(), ns3::lorawan::NwkAddr::Get(), m_nwkAddr, m_nwkId, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::lorawan::NetworkStatus::AddNode(), ns3::lorawan::LoraFrameHeader::Deserialize(), ns3::lorawan::LoraFrameHeader::Print(), and ns3::lorawan::LoraFrameHeader::Serialize().

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

◆ Serialize()

void ns3::lorawan::LoraDeviceAddress::Serialize ( uint8_t  buf[4]) const

Convert this address to a buffer.

Parameters
buf[out] buffer to fill with serialized address.

Definition at line 117 of file lora-device-address.cc.

References Get(), and NS_LOG_FUNCTION.

Referenced by ConvertTo(), and AddressTest::DoRun().

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

◆ Set() [1/2]

void ns3::lorawan::LoraDeviceAddress::Set ( uint32_t  address)

Set the address as a 32 bit integer.

Parameters
addressFull numeric value of the address.

Definition at line 195 of file lora-device-address.cc.

References m_nwkAddr, m_nwkId, NS_LOG_FUNCTION_NOARGS, ns3::lorawan::NwkAddr::Set(), and ns3::lorawan::NwkID::Set().

Referenced by LoraDeviceAddress(), and ns3::lorawan::LoraFrameHeader::Deserialize().

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

◆ Set() [2/2]

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.

Parameters
nwkIdNetwork id numeric value.
nwkAddrNetwork address numeric value.
Todo:
Not implemented, this is a placeholder for future implementation.

◆ SetNwkAddr()

void ns3::lorawan::LoraDeviceAddress::SetNwkAddr ( uint32_t  nwkAddr)

Set the NwkAddr of this device.

Remarks
The NwkAddr is expected to be contained on the least significant bits of the uint32_t.
Parameters
nwkAddrThe network address to set.

Definition at line 228 of file lora-device-address.cc.

References m_nwkAddr, NS_LOG_FUNCTION, and ns3::lorawan::NwkAddr::Set().

+ Here is the call graph for this function:

◆ SetNwkID()

void ns3::lorawan::LoraDeviceAddress::SetNwkID ( uint8_t  nwkId)

Set the NwkID of this device.

Remarks
The NwkID is expected to be contained on the 7 least significant bits of the uint8_t.
Parameters
nwkIdThe network id to set.

Definition at line 220 of file lora-device-address.cc.

References m_nwkId, NS_LOG_FUNCTION, and ns3::lorawan::NwkID::Set().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_nwkAddr

NwkAddr ns3::lorawan::LoraDeviceAddress::m_nwkAddr
private

The network address of this address.

Definition at line 283 of file lora-device-address.h.

Referenced by LoraDeviceAddress(), Get(), GetNwkAddr(), Print(), Set(), and SetNwkAddr().

◆ m_nwkId

NwkID ns3::lorawan::LoraDeviceAddress::m_nwkId
private

The network Id of this address.

Definition at line 282 of file lora-device-address.h.

Referenced by LoraDeviceAddress(), Get(), GetNwkID(), Print(), Set(), and SetNwkID().


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