A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lora-device-address-generator.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 University of Padova
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Davide Magrin <magrinda@dei.unipd.it>
7 */
8
10
11#include "ns3/log.h"
12
13namespace ns3
14{
15namespace lorawan
16{
17
18NS_LOG_COMPONENT_DEFINE("LoraDeviceAddressGenerator");
19
20TypeId
22{
23 static TypeId tid = TypeId("ns3::LoraDeviceAddressGenerator")
25 .SetGroupName("lorawan")
26 .AddConstructor<LoraDeviceAddressGenerator>();
27 return tid;
28}
29
31{
32 NS_LOG_FUNCTION(this << unsigned(nwkId) << nwkAddr);
33
34 m_currentNwkId.Set(nwkId);
35 m_currentNwkAddr.Set(nwkAddr);
36}
37
48
59
67} // namespace lorawan
68} // namespace ns3
A base class which provides memory management and object aggregation.
Definition object.h:78
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
This class generates sequential LoraDeviceAddress instances.
LoraDeviceAddress NextAddress()
Allocate the next LoraDeviceAddress.
NwkAddr m_currentNwkAddr
The current Network Address value.
NwkID m_currentNwkId
The current Network Id value.
LoraDeviceAddress GetNextAddress()
Get the LoraDeviceAddress that will be allocated upon a call to NextAddress.
LoraDeviceAddress NextNetwork()
Get the first address from the next network.
LoraDeviceAddressGenerator(const uint8_t nwkId=0, const uint32_t nwkAddr=0)
Initialise the base NwkID and the first NwkAddr to be used by the generator.
This class represents the device address of a LoraWAN end device.
Class representing the Network Address component of a LoraDeviceAddress (25 bits)
void Set(uint32_t nwkAddr)
Set the NwkAddr, starting from a 32-bit representation of a 25-bit integer.
uint32_t Get() const
Get an uint32_t representation of the 25-bit network address.
uint8_t Get() const
Get an uint8_t representation of the 7-bit network ID.
void Set(uint8_t nwkId)
Set the NwkID, starting from a 8-bit representation of a 7-bit integer.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.