A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lora-device-address-generator.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 University of Padova
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Davide Magrin <magrinda@dei.unipd.it>
18 */
19
20#ifndef LORA_DEVICE_ADDRESS_GENERATOR_H
21#define LORA_DEVICE_ADDRESS_GENERATOR_H
22
23#include "lora-device-address.h"
24
25#include "ns3/object.h"
26
27namespace ns3
28{
29namespace lorawan
30{
31
32/**
33 * \ingroup lorawan
34 *
35 * This class generates sequential LoraDeviceAddress instances.
36 */
38{
39 public:
40 /**
41 * Register this type.
42 * \return The object TypeId.
43 */
44 static TypeId GetTypeId();
45
46 /**
47 * Initialise the base NwkID and the first NwkAddr to be used by the
48 * generator.
49 *
50 * The first call to NextAddress() or GetAddress() will return these values.
51 *
52 * \param nwkId The first network id.
53 * \param nwkAddr The first address.
54 */
55 LoraDeviceAddressGenerator(const uint8_t nwkId = 0, const uint32_t nwkAddr = 0);
56
57 /**
58 * Get the first address from the next network.
59 *
60 * This resets the address to the base address that was used for
61 * initialization.
62 *
63 * \return The LoraDeviceAddress address of the next network.
64 */
66
67 /**
68 * Allocate the next LoraDeviceAddress.
69 *
70 * This operation is a post-increment, meaning that the first address
71 * allocated will be the one that was initially configured.
72 *
73 * This keeps the nwkId constant, only incrementing nwkAddr.
74 *
75 * \return The LoraDeviceAddress address.
76 */
78
79 /**
80 * Get the LoraDeviceAddress that will be allocated upon a call to
81 * NextAddress.
82 *
83 * Does not change the internal state; is just used to peek at the next
84 * address that will be allocated upon a call to NextAddress.
85 *
86 * \return The LoraDeviceAddress.
87 */
89
90 private:
91 NwkID m_currentNwkId; //!< The current Network Id value
92 NwkAddr m_currentNwkAddr; //!< The current Network Address value
93};
94} // namespace lorawan
95} // namespace ns3
96#endif
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:59
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.
This class represents the device address of a LoraWAN end device.
Class representing the Network Address component of a LoraDeviceAddress (25 bits)
Class representing the NetworkId component of a LoraDeviceAddress (7 bits).
Every class exported by the ns3 library is enclosed in the ns3 namespace.