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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Davide Magrin <magrinda@dei.unipd.it>
7 */
8
9#ifndef LORA_DEVICE_ADDRESS_GENERATOR_H
10#define LORA_DEVICE_ADDRESS_GENERATOR_H
11
12#include "lora-device-address.h"
13
14#include "ns3/object.h"
15
16namespace ns3
17{
18namespace lorawan
19{
20
21/**
22 * \ingroup lorawan
23 *
24 * This class generates sequential LoraDeviceAddress instances.
25 */
27{
28 public:
29 /**
30 * Register this type.
31 * \return The object TypeId.
32 */
33 static TypeId GetTypeId();
34
35 /**
36 * Initialise the base NwkID and the first NwkAddr to be used by the
37 * generator.
38 *
39 * The first call to NextAddress() or GetAddress() will return these values.
40 *
41 * \param nwkId The first network id.
42 * \param nwkAddr The first address.
43 */
44 LoraDeviceAddressGenerator(const uint8_t nwkId = 0, const uint32_t nwkAddr = 0);
45
46 /**
47 * Get the first address from the next network.
48 *
49 * This resets the address to the base address that was used for
50 * initialization.
51 *
52 * \return The LoraDeviceAddress address of the next network.
53 */
55
56 /**
57 * Allocate the next LoraDeviceAddress.
58 *
59 * This operation is a post-increment, meaning that the first address
60 * allocated will be the one that was initially configured.
61 *
62 * This keeps the nwkId constant, only incrementing nwkAddr.
63 *
64 * \return The LoraDeviceAddress address.
65 */
67
68 /**
69 * Get the LoraDeviceAddress that will be allocated upon a call to
70 * NextAddress.
71 *
72 * Does not change the internal state; is just used to peek at the next
73 * address that will be allocated upon a call to NextAddress.
74 *
75 * \return The LoraDeviceAddress.
76 */
78
79 private:
80 NwkID m_currentNwkId; //!< The current Network Id value
81 NwkAddr m_currentNwkAddr; //!< The current Network Address value
82};
83} // namespace lorawan
84} // namespace ns3
85#endif
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
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)
Class representing the NetworkId component of a LoraDeviceAddress (7 bits).
Every class exported by the ns3 library is enclosed in the ns3 namespace.