23#ifndef LORAWAN_MAC_COMMAND_H
24#define LORAWAN_MAC_COMMAND_H
26#include "ns3/buffer.h"
27#include "ns3/nstime.h"
28#include "ns3/object.h"
84 virtual void Serialize(Buffer::Iterator& start)
const = 0;
99 virtual void Print(std::ostream& os)
const = 0;
144 virtual void Serialize(Buffer::Iterator& start)
const;
145 virtual uint8_t
Deserialize(Buffer::Iterator& start);
146 virtual void Print(std::ostream& os)
const;
161 virtual void Serialize(Buffer::Iterator& start)
const;
162 virtual uint8_t
Deserialize(Buffer::Iterator& start);
163 virtual void Print(std::ostream& os)
const;
224 uint16_t channelMask,
228 virtual void Serialize(Buffer::Iterator& start)
const;
229 virtual uint8_t
Deserialize(Buffer::Iterator& start);
230 virtual void Print(std::ostream& os)
const;
283 LinkAdrAns(
bool powerAck,
bool dataRateAck,
bool channelMaskAck);
285 virtual void Serialize(Buffer::Iterator& start)
const;
286 virtual uint8_t
Deserialize(Buffer::Iterator& start);
287 virtual void Print(std::ostream& os)
const;
313 virtual void Serialize(Buffer::Iterator& start)
const;
314 virtual uint8_t
Deserialize(Buffer::Iterator& start);
315 virtual void Print(std::ostream& os)
const;
338 virtual void Serialize(Buffer::Iterator& start)
const;
339 virtual uint8_t
Deserialize(Buffer::Iterator& start);
340 virtual void Print(std::ostream& os)
const;
358 RxParamSetupReq(uint8_t rx1DrOffset, uint8_t rx2DataRate,
double frequency);
360 virtual void Serialize(Buffer::Iterator& start)
const;
361 virtual uint8_t
Deserialize(Buffer::Iterator& start);
362 virtual void Print(std::ostream& os)
const;
405 RxParamSetupAns(
bool rx1DrOffsetAck,
bool rx2DataRateAck,
bool channelAck);
407 virtual void Serialize(Buffer::Iterator& start)
const;
408 virtual uint8_t
Deserialize(Buffer::Iterator& start);
409 virtual void Print(std::ostream& os)
const;
425 virtual void Serialize(Buffer::Iterator& start)
const;
426 virtual uint8_t
Deserialize(Buffer::Iterator& start);
427 virtual void Print(std::ostream& os)
const;
445 virtual void Serialize(Buffer::Iterator& start)
const;
446 virtual uint8_t
Deserialize(Buffer::Iterator& start);
447 virtual void Print(std::ostream& os)
const;
484 NewChannelReq(uint8_t chIndex,
double frequency, uint8_t minDataRate, uint8_t maxDataRate);
486 virtual void Serialize(Buffer::Iterator& start)
const;
487 virtual uint8_t
Deserialize(Buffer::Iterator& start);
488 virtual void Print(std::ostream& os)
const;
518 NewChannelAns(
bool dataRateRangeOk,
bool channelFrequencyOk);
520 virtual void Serialize(Buffer::Iterator& start)
const;
521 virtual uint8_t
Deserialize(Buffer::Iterator& start);
522 virtual void Print(std::ostream& os)
const;
544 virtual void Serialize(Buffer::Iterator& start)
const;
545 virtual uint8_t
Deserialize(Buffer::Iterator& start);
546 virtual void Print(std::ostream& os)
const;
569 virtual void Serialize(Buffer::Iterator& start)
const;
570 virtual uint8_t
Deserialize(Buffer::Iterator& start);
571 virtual void Print(std::ostream& os)
const;
584 virtual void Serialize(Buffer::Iterator& start)
const;
585 virtual uint8_t
Deserialize(Buffer::Iterator& start);
586 virtual void Print(std::ostream& os)
const;
599 virtual void Serialize(Buffer::Iterator& start)
const;
600 virtual uint8_t
Deserialize(Buffer::Iterator& start);
601 virtual void Print(std::ostream& os)
const;
614 virtual void Serialize(Buffer::Iterator& start)
const;
615 virtual uint8_t
Deserialize(Buffer::Iterator& start);
616 virtual void Print(std::ostream& os)
const;
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
uint8_t GetBattery(void)
Get the battery information contained in this MAC command.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
uint8_t GetMargin(void)
Get the demodulation margin contained in this MAC command.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
double GetMaximumAllowedDutyCycle(void) const
Get the maximum duty cycle prescribed by this Mac command, in fraction form.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
int GetRepetitions(void)
Get the number of repetitions prescribed by this MAC command.
std::list< int > GetEnabledChannelsList(void)
Get the list of enabled channels.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
uint8_t GetTxPower(void)
Get the transmission power prescribed by this MAC command.
uint8_t GetDataRate(void)
Return the data rate prescribed by this MAC command.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
uint8_t GetGwCnt(void) const
Get the gateway count value.
uint8_t GetMargin(void) const
Get the demodulation margin value.
uint8_t m_gwCnt
This MAC command's gateway count value.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
uint8_t m_margin
This MAC command's demodulation margin value.
void SetMargin(uint8_t margin)
Set the demodulation margin value.
void SetGwCnt(uint8_t gwCnt)
Set the gateway count value.
void IncrementGwCnt(void)
Increment this LorawanMacCommand's gwCnt value.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
static uint8_t GetCIDFromLorawanMacCommand(enum MacCommandType commandType)
Get the CID that corresponds to this MAC command.
virtual uint8_t Deserialize(Buffer::Iterator &start)=0
Deserialize the buffer into a MAC command.
enum MacCommandType m_commandType
The type of this command.
virtual uint8_t GetSerializedSize(void) 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.
static TypeId GetTypeId(void)
virtual enum MacCommandType GetCommandType(void) const
Get the commandType of this MAC command.
uint8_t m_serializedSize
This MAC command's serialized size.
virtual void Serialize(Buffer::Iterator &start) const =0
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual ~LorawanMacCommand()
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
bool m_channelFrequencyOk
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
double GetFrequency(void)
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
uint8_t GetMinDataRate(void)
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
uint8_t GetChannelIndex(void)
uint8_t GetMaxDataRate(void)
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
double m_frequency
The frequency in Hz.
uint8_t GetRx1DrOffset(void)
Get this command's Rx1DrOffset parameter.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
uint8_t GetRx2DataRate(void)
Get this command's Rx2DataRate parameter.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
double GetFrequency(void)
Get this command's frequency.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
Time GetDelay(void)
Get the first window delay as a Time instance.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
virtual void Serialize(Buffer::Iterator &start) const
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
virtual void Print(std::ostream &os) const
Print the contents of this MAC command in human-readable format.
virtual uint8_t Deserialize(Buffer::Iterator &start)
Deserialize the buffer into a MAC command.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
MacCommandType
Enum for every possible command type.