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