A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
9
#include "
lora-device-address-generator.h
"
10
11
namespace
ns3
12
{
13
namespace
lorawan
14
{
15
16
NS_LOG_COMPONENT_DEFINE
(
"LoraDeviceAddressGenerator"
);
17
18
TypeId
19
LoraDeviceAddressGenerator::GetTypeId
()
20
{
21
static
TypeId
tid =
TypeId
(
"ns3::LoraDeviceAddressGenerator"
)
22
.
SetParent
<
Object
>()
23
.SetGroupName(
"lorawan"
)
24
.AddConstructor<
LoraDeviceAddressGenerator
>();
25
return
tid;
26
}
27
28
LoraDeviceAddressGenerator::LoraDeviceAddressGenerator
(
const
uint8_t nwkId,
const
uint32_t
nwkAddr)
29
{
30
NS_LOG_FUNCTION
(
this
<<
unsigned
(nwkId) << nwkAddr);
31
32
m_currentNwkId
.Set(nwkId);
33
m_currentNwkAddr
.Set(nwkAddr);
34
}
35
36
LoraDeviceAddress
37
LoraDeviceAddressGenerator::NextNetwork
()
38
{
39
NS_LOG_FUNCTION_NOARGS
();
40
41
m_currentNwkId
.Set(
m_currentNwkId
.Get() + 1);
42
m_currentNwkAddr
.Set(0);
43
44
return
LoraDeviceAddress
(
m_currentNwkId
,
m_currentNwkAddr
);
45
}
46
47
LoraDeviceAddress
48
LoraDeviceAddressGenerator::NextAddress
()
49
{
50
NS_LOG_FUNCTION_NOARGS
();
51
52
NwkAddr
oldNwkAddr =
m_currentNwkAddr
;
53
m_currentNwkAddr
.Set(
m_currentNwkAddr
.Get() + 1);
54
55
return
LoraDeviceAddress
(
m_currentNwkId
, oldNwkAddr);
56
}
57
58
LoraDeviceAddress
59
LoraDeviceAddressGenerator::GetNextAddress
()
60
{
61
NS_LOG_FUNCTION_NOARGS
();
62
63
return
LoraDeviceAddress
(
m_currentNwkId
.Get(),
m_currentNwkAddr
.Get() + 1);
64
}
65
66
}
// namespace lorawan
67
}
// namespace ns3
ns3::Object::Object
Object()
Caller graph was not generated because of its size.
Definition
object.cc:93
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:50
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:999
ns3::lorawan::LoraDeviceAddressGenerator::NextAddress
LoraDeviceAddress NextAddress()
Allocate the next LoraDeviceAddress.
Definition
lora-device-address-generator.cc:48
ns3::lorawan::LoraDeviceAddressGenerator::m_currentNwkAddr
NwkAddr m_currentNwkAddr
The current Network Address value.
Definition
lora-device-address-generator.h:81
ns3::lorawan::LoraDeviceAddressGenerator::m_currentNwkId
NwkID m_currentNwkId
The current Network Id value.
Definition
lora-device-address-generator.h:80
ns3::lorawan::LoraDeviceAddressGenerator::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
lora-device-address-generator.cc:19
ns3::lorawan::LoraDeviceAddressGenerator::GetNextAddress
LoraDeviceAddress GetNextAddress()
Get the LoraDeviceAddress that will be allocated upon a call to NextAddress.
Definition
lora-device-address-generator.cc:59
ns3::lorawan::LoraDeviceAddressGenerator::NextNetwork
LoraDeviceAddress NextNetwork()
Get the first address from the next network.
Definition
lora-device-address-generator.cc:37
ns3::lorawan::LoraDeviceAddressGenerator::LoraDeviceAddressGenerator
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.
Definition
lora-device-address-generator.cc:28
ns3::lorawan::LoraDeviceAddress
This class represents the device address of a LoraWAN end device.
Definition
lora-device-address.h:104
ns3::lorawan::NwkAddr
Class representing the Network Address component of a LoraDeviceAddress (25 bits).
Definition
lora-device-address.h:65
uint32_t
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:194
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition
log-macros-enabled.h:195
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:231
lora-device-address-generator.h
ns3::lorawan
Definition
forwarder-helper.cc:19
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lorawan
model
lora-device-address-generator.cc
Generated on
for ns-3 by
1.15.0