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>
80 virtual void Serialize(Buffer::Iterator& start)
const = 0;
95 virtual void Print(std::ostream& os)
const = 0;
140 virtual void Serialize(Buffer::Iterator& start)
const;
141 virtual uint8_t
Deserialize(Buffer::Iterator& start);
142 virtual void Print(std::ostream& os)
const;
157 virtual void Serialize(Buffer::Iterator& start)
const;
158 virtual uint8_t
Deserialize(Buffer::Iterator& start);
159 virtual void Print(std::ostream& os)
const;
220 uint16_t channelMask,
224 virtual void Serialize(Buffer::Iterator& start)
const;
225 virtual uint8_t
Deserialize(Buffer::Iterator& start);
226 virtual void Print(std::ostream& os)
const;
279 LinkAdrAns(
bool powerAck,
bool dataRateAck,
bool channelMaskAck);
281 virtual void Serialize(Buffer::Iterator& start)
const;
282 virtual uint8_t
Deserialize(Buffer::Iterator& start);
283 virtual void Print(std::ostream& os)
const;
309 virtual void Serialize(Buffer::Iterator& start)
const;
310 virtual uint8_t
Deserialize(Buffer::Iterator& start);
311 virtual void Print(std::ostream& os)
const;
334 virtual void Serialize(Buffer::Iterator& start)
const;
335 virtual uint8_t
Deserialize(Buffer::Iterator& start);
336 virtual void Print(std::ostream& os)
const;
354 RxParamSetupReq(uint8_t rx1DrOffset, uint8_t rx2DataRate,
double frequency);
356 virtual void Serialize(Buffer::Iterator& start)
const;
357 virtual uint8_t
Deserialize(Buffer::Iterator& start);
358 virtual void Print(std::ostream& os)
const;
401 RxParamSetupAns(
bool rx1DrOffsetAck,
bool rx2DataRateAck,
bool channelAck);
403 virtual void Serialize(Buffer::Iterator& start)
const;
404 virtual uint8_t
Deserialize(Buffer::Iterator& start);
405 virtual void Print(std::ostream& os)
const;
421 virtual void Serialize(Buffer::Iterator& start)
const;
422 virtual uint8_t
Deserialize(Buffer::Iterator& start);
423 virtual void Print(std::ostream& os)
const;
441 virtual void Serialize(Buffer::Iterator& start)
const;
442 virtual uint8_t
Deserialize(Buffer::Iterator& start);
443 virtual void Print(std::ostream& os)
const;
480 NewChannelReq(uint8_t chIndex,
double frequency, uint8_t minDataRate, uint8_t maxDataRate);
482 virtual void Serialize(Buffer::Iterator& start)
const;
483 virtual uint8_t
Deserialize(Buffer::Iterator& start);
484 virtual void Print(std::ostream& os)
const;
514 NewChannelAns(
bool dataRateRangeOk,
bool channelFrequencyOk);
516 virtual void Serialize(Buffer::Iterator& start)
const;
517 virtual uint8_t
Deserialize(Buffer::Iterator& start);
518 virtual void Print(std::ostream& os)
const;
540 virtual void Serialize(Buffer::Iterator& start)
const;
541 virtual uint8_t
Deserialize(Buffer::Iterator& start);
542 virtual void Print(std::ostream& os)
const;
565 virtual void Serialize(Buffer::Iterator& start)
const;
566 virtual uint8_t
Deserialize(Buffer::Iterator& start);
567 virtual void Print(std::ostream& os)
const;
580 virtual void Serialize(Buffer::Iterator& start)
const;
581 virtual uint8_t
Deserialize(Buffer::Iterator& start);
582 virtual void Print(std::ostream& os)
const;
595 virtual void Serialize(Buffer::Iterator& start)
const;
596 virtual uint8_t
Deserialize(Buffer::Iterator& start);
597 virtual void Print(std::ostream& os)
const;
610 virtual void Serialize(Buffer::Iterator& start)
const;
611 virtual uint8_t
Deserialize(Buffer::Iterator& start);
612 virtual void Print(std::ostream& os)
const;
Implementation of the DevStatusAns LoRaWAN MAC command.
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.
Implementation of the DevStatusReq LoRaWAN MAC command.
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.
Implementation of the DlChannelAns LoRaWAN MAC command.
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.
Implementation of the DutyCycleAns LoRaWAN MAC command.
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.
Implementation of the DutyCycleReq LoRaWAN 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.
double GetMaximumAllowedDutyCycle(void) const
Get the maximum duty cycle prescribed by this Mac command, in fraction form.
Implementation of the LinkAdrAns LoRaWAN 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.
Implementation of the LinkAdrReq LoRaWAN 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.
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.
Implementation of the LinkCheckAns LoRaWAN 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.
Implementation of the LinkCheckReq LoRaWAN MAC command.
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.
This base class is used to represent a general MAC command.
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()
Implementation of the NewChannelAns LoRaWAN MAC command.
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.
Implementation of the NewChannelReq LoRaWAN MAC command.
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)
Implementation of the RxParamSetupAns LoRaWAN 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.
Implementation of the RxParamSetupReq LoRaWAN 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.
Implementation of the RxTimingSetupAns LoRaWAN MAC command.
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.
Implementation of the RxTimingSetupReq LoRaWAN 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.
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.
Implementation of the TxParamSetupAns LoRaWAN 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.
Implementation of the TxParamSetupReq LoRaWAN 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.