A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
mac-command.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 MAC_COMMAND_H
10#define MAC_COMMAND_H
11
12#include "ns3/buffer.h"
13#include "ns3/nstime.h"
14#include "ns3/object.h"
15
16namespace ns3
17{
18namespace lorawan
19{
20
21/**
22 * Enum for every possible command type
23 */
46
47/**
48 * \ingroup lorawan
49 *
50 * This base class is used to represent a general MAC command.
51 *
52 * Pure virtual methods that handle serialization, deserialization and other
53 * common features are supposed to be defined in detail by child classes, based
54 * on that MAC command's attributes and structure.
55 */
56class MacCommand : public Object
57{
58 public:
59 /**
60 * Register this type.
61 * \return The object TypeId.
62 */
63 static TypeId GetTypeId();
64
65 MacCommand(); //!< Default constructor
66 ~MacCommand() override; //!< Destructor
67
68 /**
69 * Serialize the contents of this MAC command into a buffer, according to the
70 * LoRaWAN standard.
71 *
72 * \param start A pointer to the buffer into which to serialize the command.
73 */
74 virtual void Serialize(Buffer::Iterator& start) const = 0;
75
76 /**
77 * Deserialize the buffer into a MAC command.
78 *
79 * \param start A pointer to the buffer that contains the serialized command.
80 * \return The number of bytes that were consumed.
81 */
82 virtual uint8_t Deserialize(Buffer::Iterator& start) = 0;
83
84 /**
85 * Print the contents of this MAC command in human-readable format.
86 *
87 * \param os The std::ostream instance on which to print the MAC command.
88 */
89 virtual void Print(std::ostream& os) const = 0;
90
91 /**
92 * Get serialized length of this MAC command.
93 *
94 * \return The number of bytes the MAC command takes up.
95 */
96 virtual uint8_t GetSerializedSize() const;
97
98 /**
99 * Get the commandType of this MAC command.
100 *
101 * \return The type of MAC command this object represents.
102 */
103 virtual enum MacCommandType GetCommandType() const;
104
105 /**
106 * Get the CID that corresponds to a type of MAC command.
107 *
108 * \param commandType The type of MAC command.
109 * \return The CID as a uint8_t type.
110 */
111 static uint8_t GetCIDFromMacCommand(enum MacCommandType commandType);
112
113 protected:
114 enum MacCommandType m_commandType; //!< The type of this command.
115 uint8_t m_serializedSize; //!< This MAC command's serialized size.
116};
117
118/**
119 * \ingroup lorawan
120 *
121 * Implementation of the LinkCheckReq LoRaWAN MAC command.
122 *
123 * This command holds no variables, and just consists in the CID.
124 */
126{
127 public:
128 LinkCheckReq();
129 ~LinkCheckReq() override; //!< Destructor
130 void Serialize(Buffer::Iterator& start) const override;
131 uint8_t Deserialize(Buffer::Iterator& start) override;
132 void Print(std::ostream& os) const override;
133};
134
135/**
136 * \ingroup lorawan
137 *
138 * Implementation of the LinkCheckAns LoRaWAN MAC command.
139 *
140 * This command contains the demodulation margin and the number of receiving
141 * gateways of the packet containing the LinkCheckReq command.
142 */
144{
145 public:
146 LinkCheckAns(); //!< Default constructor
147
148 /**
149 * Constructor with given fields.
150 *
151 * \param margin The demodulation margin to set.
152 * \param gwCnt The gateway count to set.
153 */
154 LinkCheckAns(uint8_t margin, uint8_t gwCnt);
155
156 void Serialize(Buffer::Iterator& start) const override;
157 uint8_t Deserialize(Buffer::Iterator& start) override;
158 void Print(std::ostream& os) const override;
159
160 /**
161 * Set the demodulation margin value.
162 *
163 * \param margin The demodulation margin to set.
164 */
165 void SetMargin(uint8_t margin);
166
167 /**
168 * Get the demodulation margin value.
169 *
170 * \return The demodulation margin value.
171 */
172 uint8_t GetMargin() const;
173
174 /**
175 * Set the gateway count value.
176 *
177 * \param gwCnt The count value to set.
178 */
179 void SetGwCnt(uint8_t gwCnt);
180
181 /**
182 * Get the gateway count value.
183 *
184 * \return The gateway count value.
185 */
186 uint8_t GetGwCnt() const;
187
188 /**
189 * Increment this MacCommand's gwCnt value.
190 */
191 void IncrementGwCnt();
192
193 private:
194 uint8_t m_margin; //!< This MAC command's demodulation margin value.
195 uint8_t m_gwCnt; //!< This MAC command's gateway count value.
196};
197
198/**
199 * \ingroup lorawan
200 *
201 * Implementation of the LinkAdrReq LoRaWAN MAC command.
202 *
203 * With this command, the network server can request a device to change its
204 * data rate, transmission power and the channel it uses for uplink
205 * transmissions.
206 */
207class LinkAdrReq : public MacCommand
208{
209 public:
210 LinkAdrReq();
211 /**
212 * Constructor with given fields.
213 *
214 * The parameters of this constructor are serializable fields of the MAC command specified by
215 * the LoRaWAN protocol. They represent MAC and PHY layer configurations to be applied by the
216 * receiving end device. See, [LoRaWAN® L2 1.0.4 Specification (TS001-1.0.4)] and [LoRaWAN®
217 * Regional Parameters RP002-1.0.4] for more details on how the fields are used and which
218 * physical values they stand for.
219 *
220 * \param dataRate The DataRate field to set.
221 * \param txPower The TXPower field to set.
222 * \param channelMask The ChMask field to set.
223 * \param chMaskCntl The ChMaskCntl field to set.
224 * \param nbRep The NbTrans field to set.
225 */
226 LinkAdrReq(uint8_t dataRate,
227 uint8_t txPower,
228 uint16_t channelMask,
229 uint8_t chMaskCntl,
230 uint8_t nbRep);
231
232 void Serialize(Buffer::Iterator& start) const override;
233 uint8_t Deserialize(Buffer::Iterator& start) override;
234 void Print(std::ostream& os) const override;
235
236 /**
237 * Return the data rate prescribed by this MAC command.
238 *
239 * \return An unsigned 8-bit integer containing the data rate.
240 */
241 uint8_t GetDataRate();
242
243 /**
244 * Get the transmission power prescribed by this MAC command.
245 *
246 * The MAC layer is expected to translate this value to a certain power in
247 * dBm when communicating it to the PHY, and the translation will vary based
248 * on the region of the device.
249 *
250 * \return The TX power, encoded as an unsigned 8-bit integer.
251 */
252 uint8_t GetTxPower();
253
254 /**
255 * Get the list of enabled channels. This method takes the 16-bit channel mask
256 * and translates it to a list of integers that can be more easily parsed.
257 *
258 * \return The list of enabled channels.
259 */
260 std::list<int> GetEnabledChannelsList();
261
262 /**
263 * Get the number of repetitions prescribed by this MAC command.
264 *
265 * \return The number of repetitions.
266 */
267 int GetRepetitions();
268
269 private:
270 uint8_t m_dataRate; //!< The DataRate field, a serializable parameter for setting the
271 //!< spreading factor and bandwidth of end devices
272 uint8_t m_txPower; //!< The TXPower field, a serializable parameter for setting the
273 //!< transmission power of end devices
274 uint16_t m_channelMask; //!< The ChMask field
275 uint8_t m_chMaskCntl; //!< The ChMaskCntl field
276 uint8_t m_nbRep; //!< The NbTrans field
277};
278
279/**
280 * \ingroup lorawan
281 *
282 * Implementation of the LinkAdrAns LoRaWAN MAC command.
283 *
284 * With this command, the end device acknowledges a LinkAdrReq.
285 */
286class LinkAdrAns : public MacCommand
287{
288 public:
289 LinkAdrAns(); //!< Default constructor
290
291 /**
292 * Constructor with given fields.
293 *
294 * \param powerAck The PowerACK field to set.
295 * \param dataRateAck The DataRateACK field to set.
296 * \param channelMaskAck The ChannelMaskACK field to set.
297 */
298 LinkAdrAns(bool powerAck, bool dataRateAck, bool channelMaskAck);
299
300 void Serialize(Buffer::Iterator& start) const override;
301 uint8_t Deserialize(Buffer::Iterator& start) override;
302 void Print(std::ostream& os) const override;
303
304 private:
305 bool m_powerAck; //!< The PowerACK field
306 bool m_dataRateAck; //!< The DataRateACK field
307 bool m_channelMaskAck; //!< The ChannelMaskACK field
308};
309
310/**
311 * \ingroup lorawan
312 *
313 * Implementation of the DutyCycleReq LoRaWAN MAC command.
314 *
315 * With this command, the network server can limit the maximum aggregated
316 * transmit duty cycle of an end device. The aggregate duty cycle is computed
317 * as the duty cycle among all sub bands.
318 */
320{
321 public:
322 DutyCycleReq();
323 /**
324 * Constructor providing initialization of all parameters.
325 *
326 * \param dutyCycle The duty cycle as a 8-bit unsigned integer.
327 */
328 DutyCycleReq(uint8_t dutyCycle);
329
330 void Serialize(Buffer::Iterator& start) const override;
331 uint8_t Deserialize(Buffer::Iterator& start) override;
332 void Print(std::ostream& os) const override;
333
334 /**
335 * Get the maximum duty cycle prescribed by this Mac command, in fraction form.
336 *
337 * \return The maximum duty cycle.
338 */
339 double GetMaximumAllowedDutyCycle() const;
340
341 private:
342 uint8_t m_maxDCycle; //!< The MaxDutyCycle field
343};
344
345/**
346 * \ingroup lorawan
347 *
348 * Implementation of the DutyCycleAns LoRaWAN MAC command.
349 *
350 * This command holds no variables, and just consists in the CID.
351 */
353{
354 public:
355 DutyCycleAns(); //!< Default constructor
356
357 void Serialize(Buffer::Iterator& start) const override;
358 uint8_t Deserialize(Buffer::Iterator& start) override;
359 void Print(std::ostream& os) const override;
360};
361
362/**
363 * \ingroup lorawan
364 *
365 * Implementation of the RxParamSetupReq LoRaWAN MAC command.
366 *
367 * \todo The use of frequencies in Hz here will cause problems for users, as frequencies are in MHz
368 * in the rest of the module code. IMO it would be better to have freqs in Hz as uint32_t
369 */
371{
372 public:
374
375 /**
376 * Constructor providing initialization of all fields.
377 *
378 * \param rx1DrOffset The data rate offset to use for the first receive window.
379 * \param rx2DataRate The data rate to use for the second receive window.
380 * \param frequency The frequency in Hz to use for the second receive window.
381 */
382 RxParamSetupReq(uint8_t rx1DrOffset, uint8_t rx2DataRate, double frequency);
383
384 void Serialize(Buffer::Iterator& start) const override;
385 uint8_t Deserialize(Buffer::Iterator& start) override;
386 void Print(std::ostream& os) const override;
387
388 /**
389 * Get this command's Rx1DrOffset parameter.
390 *
391 * \return The Rx1DrOffset parameter.
392 */
393 uint8_t GetRx1DrOffset();
394
395 /**
396 * Get this command's Rx2DataRate parameter.
397 *
398 * \return The Rx2DataRate parameter.
399 */
400 uint8_t GetRx2DataRate();
401
402 /**
403 * Get this command's frequency.
404 *
405 * \return The frequency parameter, in Hz.
406 */
407 double GetFrequency();
408
409 private:
410 uint8_t m_rx1DrOffset; //!< The RX1DROffset field
411 uint8_t m_rx2DataRate; //!< The RX2DataRate field
412 double m_frequency; //!< The Frequency field, _in Hz_
413};
414
415/**
416 * \ingroup lorawan
417 *
418 * Implementation of the RxParamSetupAns LoRaWAN MAC command.
419 */
421{
422 public:
424 /**
425 * Constructor with initialization of all parameters.
426 *
427 * \param rx1DrOffsetAck Whether or not the offset was correctly set.
428 * \param rx2DataRateAck Whether or not the second slot data rate was correctly set.
429 * \param channelAck Whether or not the second slot frequency was correctly set.
430 */
431 RxParamSetupAns(bool rx1DrOffsetAck, bool rx2DataRateAck, bool channelAck);
432
433 void Serialize(Buffer::Iterator& start) const override;
434 uint8_t Deserialize(Buffer::Iterator& start) override;
435 void Print(std::ostream& os) const override;
436
437 private:
438 bool m_rx1DrOffsetAck; //!< The RX1DROffsetACK field
439 bool m_rx2DataRateAck; //!< The RX2DataRateACK field
440 bool m_channelAck; //!< The ChannelACK field
441};
442
443/**
444 * \ingroup lorawan
445 *
446 * Implementation of the DevStatusReq LoRaWAN MAC command.
447 */
449{
450 public:
451 DevStatusReq();
452
453 void Serialize(Buffer::Iterator& start) const override;
454 uint8_t Deserialize(Buffer::Iterator& start) override;
455 void Print(std::ostream& os) const override;
456};
457
458/**
459 * \ingroup lorawan
460 *
461 * Implementation of the DevStatusAns LoRaWAN MAC command.
462 */
464{
465 public:
466 DevStatusAns(); //!< Default constructor
467
468 /**
469 * Constructor with initialization of all parameters.
470 *
471 * \param battery The battery level in [0, 255].
472 * \param margin The demodulation margin of the last received DevStatusReq packet.
473 */
474 DevStatusAns(uint8_t battery, uint8_t margin);
475
476 void Serialize(Buffer::Iterator& start) const override;
477 uint8_t Deserialize(Buffer::Iterator& start) override;
478 void Print(std::ostream& os) const override;
479
480 /**
481 * Get the battery information contained in this MAC command.
482 *
483 * \return The battery level.
484 */
485 uint8_t GetBattery() const;
486
487 /**
488 * Get the demodulation margin contained in this MAC command.
489 *
490 * \return The margin.
491 */
492 uint8_t GetMargin() const;
493
494 private:
495 uint8_t m_battery; //!< The Battery field
496 uint8_t m_margin; //!< The RadioStatus field
497};
498
499/**
500 * \ingroup lorawan
501 *
502 * Implementation of the NewChannelReq LoRaWAN MAC command.
503 *
504 * \todo The use of frequencies in Hz here will cause problems for users, as frequencies are in
505 * MHz in the rest of the module code. IMO it would be better to have freqs in Hz as uint32_t
506 */
508{
509 public:
511
512 /**
513 * Constructor providing initialization of all parameters.
514 *
515 * \param chIndex The index of the channel this command wants to operate on.
516 * \param frequency The new frequency for this channel in Hz.
517 * \param minDataRate The minimum data rate allowed on this channel.
518 * \param maxDataRate The maximum data rate allowed on this channel.
519 */
520 NewChannelReq(uint8_t chIndex, double frequency, uint8_t minDataRate, uint8_t maxDataRate);
521
522 void Serialize(Buffer::Iterator& start) const override;
523 uint8_t Deserialize(Buffer::Iterator& start) override;
524 void Print(std::ostream& os) const override;
525
526 /**
527 * Get the the ChIndex field contained in this MAC command.
528 *
529 * \return The ChIndex field.
530 */
531 uint8_t GetChannelIndex() const;
532 /**
533 * Get the the Frequency field contained in this MAC command.
534 *
535 * \return The Frequency field in Hz.
536 */
537 double GetFrequency() const;
538 /**
539 * Get the the MinDR field contained in this MAC command.
540 *
541 * \return The MinDR field.
542 */
543 uint8_t GetMinDataRate() const;
544 /**
545 * Get the the MaxDR field contained in this MAC command.
546 *
547 * \return The MaxDR field.
548 */
549 uint8_t GetMaxDataRate() const;
550
551 private:
552 uint8_t m_chIndex; //!< The ChIndex field
553 double m_frequency; //!< The Frequency field, in Hz
554 uint8_t m_minDataRate; //!< The MinDR field
555 uint8_t m_maxDataRate; //!< The MaxDR field
556};
557
558/**
559 * \ingroup lorawan
560 *
561 * Implementation of the NewChannelAns LoRaWAN MAC command.
562 */
564{
565 public:
566 NewChannelAns(); //!< Default constructor
567
568 /**
569 * Constructor providing initialization of all parameters.
570 *
571 * \param dataRateRangeOk Whether or not the requested data rate range was set
572 * correctly.
573 * \param channelFrequencyOk Whether or not the requested channel frequency
574 * was set correctly.
575 */
576 NewChannelAns(bool dataRateRangeOk, bool channelFrequencyOk);
577
578 void Serialize(Buffer::Iterator& start) const override;
579 uint8_t Deserialize(Buffer::Iterator& start) override;
580 void Print(std::ostream& os) const override;
581
582 private:
583 bool m_dataRateRangeOk; //!< The Data-rate range ok field
584 bool m_channelFrequencyOk; //!< The Channel frequency ok field
585};
586
587/**
588 * \ingroup lorawan
589 *
590 * Implementation of the RxTimingSetupReq LoRaWAN MAC command.
591 */
593{
594 public:
596
597 /**
598 * Constructor providing initialization of all parameters.
599 *
600 * \param delay The delay encoded in this MAC command.
601 */
602 RxTimingSetupReq(uint8_t delay);
603
604 void Serialize(Buffer::Iterator& start) const override;
605 uint8_t Deserialize(Buffer::Iterator& start) override;
606 void Print(std::ostream& os) const override;
607
608 /**
609 * Get the first window delay as a Time instance.
610 *
611 * \return The delay.
612 */
613 Time GetDelay();
614
615 private:
616 uint8_t m_delay; //!< The Del field
617};
618
619/**
620 * \ingroup lorawan
621 *
622 * Implementation of the RxTimingSetupAns LoRaWAN MAC command.
623 *
624 * This MAC command has an empty payload.
625 */
627{
628 public:
630
631 void Serialize(Buffer::Iterator& start) const override;
632 uint8_t Deserialize(Buffer::Iterator& start) override;
633 void Print(std::ostream& os) const override;
634
635 private:
636};
637
638/**
639 * \ingroup lorawan
640 *
641 * Implementation of the TxParamSetupAns LoRaWAN MAC command.
642 */
644{
645 public:
646 TxParamSetupAns(); //!< Default constructor
647
648 void Serialize(Buffer::Iterator& start) const override;
649 uint8_t Deserialize(Buffer::Iterator& start) override;
650 void Print(std::ostream& os) const override;
651
652 private:
653};
654
655/**
656 * \ingroup lorawan
657 *
658 * Implementation of the TxParamSetupReq LoRaWAN MAC command.
659 */
661{
662 public:
664
665 void Serialize(Buffer::Iterator& start) const override;
666 uint8_t Deserialize(Buffer::Iterator& start) override;
667 void Print(std::ostream& os) const override;
668
669 private:
670};
671
672/**
673 * \ingroup lorawan
674 *
675 * Implementation of the DlChannelAns LoRaWAN MAC command.
676 */
678{
679 public:
680 DlChannelAns(); //!< Default constructor
681
682 void Serialize(Buffer::Iterator& start) const override;
683 uint8_t Deserialize(Buffer::Iterator& start) override;
684 void Print(std::ostream& os) const override;
685
686 private:
687};
688} // namespace lorawan
689
690} // namespace ns3
691#endif /* DEVICE_STATUS_H */
iterator in a Buffer instance
Definition buffer.h:89
A base class which provides memory management and object aggregation.
Definition object.h:78
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Implementation of the DevStatusAns LoRaWAN MAC command.
uint8_t GetMargin() const
Get the demodulation margin contained in this MAC command.
DevStatusAns()
Default constructor.
uint8_t m_battery
The Battery field.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
uint8_t GetBattery() const
Get the battery information contained in this MAC command.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
uint8_t m_margin
The RadioStatus field.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
Implementation of the DevStatusReq LoRaWAN MAC command.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
Implementation of the DlChannelAns LoRaWAN MAC command.
DlChannelAns()
Default constructor.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
Implementation of the DutyCycleAns LoRaWAN MAC command.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
DutyCycleAns()
Default constructor.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
Implementation of the DutyCycleReq LoRaWAN MAC command.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
double GetMaximumAllowedDutyCycle() const
Get the maximum duty cycle prescribed by this Mac command, in fraction form.
uint8_t m_maxDCycle
The MaxDutyCycle field.
This base class is used to represent a general MAC command.
Definition mac-command.h:57
virtual enum MacCommandType GetCommandType() const
Get the commandType of this MAC command.
virtual void Serialize(Buffer::Iterator &start) const =0
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual uint8_t GetSerializedSize() const
Get serialized length of this MAC command.
virtual void Print(std::ostream &os) const =0
Print the contents of this MAC command in human-readable format.
uint8_t m_serializedSize
This MAC command's serialized size.
enum MacCommandType m_commandType
The type of this command.
static uint8_t GetCIDFromMacCommand(enum MacCommandType commandType)
Get the CID that corresponds to a type of MAC command.
static TypeId GetTypeId()
Register this type.
~MacCommand() override
Destructor.
MacCommand()
Default constructor.
virtual uint8_t Deserialize(Buffer::Iterator &start)=0
Deserialize the buffer into a MAC command.
Implementation of the NewChannelAns LoRaWAN MAC command.
bool m_channelFrequencyOk
The Channel frequency ok field.
NewChannelAns()
Default constructor.
bool m_dataRateRangeOk
The Data-rate range ok field.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
Implementation of the NewChannelReq LoRaWAN MAC command.
double m_frequency
The Frequency field, in Hz.
uint8_t GetMinDataRate() const
Get the the MinDR field contained in this MAC command.
uint8_t GetMaxDataRate() const
Get the the MaxDR field contained in this MAC command.
uint8_t m_maxDataRate
The MaxDR field.
double GetFrequency() const
Get the the Frequency field contained in this MAC command.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
uint8_t m_minDataRate
The MinDR field.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
uint8_t GetChannelIndex() const
Get the the ChIndex field contained in this MAC command.
uint8_t m_chIndex
The ChIndex field.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
Implementation of the RxParamSetupAns LoRaWAN MAC command.
bool m_rx2DataRateAck
The RX2DataRateACK field.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
bool m_channelAck
The ChannelACK field.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
bool m_rx1DrOffsetAck
The RX1DROffsetACK field.
Implementation of the RxParamSetupReq LoRaWAN MAC command.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
uint8_t GetRx1DrOffset()
Get this command's Rx1DrOffset parameter.
uint8_t m_rx2DataRate
The RX2DataRate field.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
uint8_t GetRx2DataRate()
Get this command's Rx2DataRate parameter.
double GetFrequency()
Get this command's frequency.
uint8_t m_rx1DrOffset
The RX1DROffset field.
double m_frequency
The Frequency field, in Hz
Implementation of the RxTimingSetupAns LoRaWAN MAC command.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
Implementation of the RxTimingSetupReq LoRaWAN MAC command.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
uint8_t m_delay
The Del field.
Time GetDelay()
Get the first window delay as a Time instance.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
Implementation of the TxParamSetupAns LoRaWAN MAC command.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
TxParamSetupAns()
Default constructor.
Implementation of the TxParamSetupReq LoRaWAN MAC command.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
MacCommandType
Enum for every possible command type.
Definition mac-command.h:25
Every class exported by the ns3 library is enclosed in the ns3 namespace.