132 NS_LOG_DEBUG(
"Serialized LinkCheckReq: " <<
unsigned(cid));
151 os <<
"LinkCheckReq" << std::endl;
208 os <<
"LinkCheckAns" << std::endl;
209 os <<
"margin: " << unsigned(
m_margin) << std::endl;
210 os <<
"gwCnt: " << unsigned(
m_gwCnt) << std::endl;
267 uint16_t channelMask,
270 : m_dataRate(dataRate),
272 m_channelMask(channelMask),
273 m_chMaskCntl(chMaskCntl),
301 uint8_t firstByte = start.ReadU8();
305 uint8_t fourthByte = start.ReadU8();
317 os <<
"LinkAdrReq" << std::endl;
318 os <<
"dataRate: " << unsigned(
m_dataRate) << std::endl;
319 os <<
"txPower: " << unsigned(
m_txPower) << std::endl;
320 os <<
"channelMask: " << std::bitset<16>(
m_channelMask) << std::endl;
321 os <<
"chMaskCntl: " << unsigned(
m_chMaskCntl) << std::endl;
322 os <<
"nbRep: " << unsigned(
m_nbRep) << std::endl;
346 std::list<int> channelIndices;
347 for (
int i = 0; i < 16; i++)
352 channelIndices.push_back(i);
356 return channelIndices;
380 : m_powerAck(powerAck),
381 m_dataRateAck(dataRateAck),
382 m_channelMaskAck(channelMaskAck)
411 uint8_t
byte = start.ReadU8();
425 os <<
"LinkAdrAns" << std::endl;
441 : m_maxDCycle(dutyCycle)
476 os <<
"DutyCycleReq" << std::endl;
477 os <<
"maxDCycle: " << unsigned(
m_maxDCycle) << std::endl;
536 os <<
"DutyCycleAns" << std::endl;
552 : m_rx1DrOffset(rx1DrOffset),
553 m_rx2DataRate(rx2DataRate),
554 m_frequency(frequency)
556 NS_LOG_FUNCTION(
this <<
unsigned(rx1DrOffset) <<
unsigned(rx2DataRate) << frequency);
558 if ((rx1DrOffset & 0b11111000) != 0)
561 "Warning: received an rx1DrOffset greater than 7. Actual value will be different.");
563 if ((rx2DataRate & 0b11110000) != 0)
566 "Warning: received a rx2DataRate greater than 15. Actual value will be different.");
585 start.WriteU8((encodedFrequency & 0xff0000) >> 16);
586 start.WriteU8((encodedFrequency & 0xff00) >> 8);
587 start.WriteU8(encodedFrequency & 0xff);
598 uint8_t firstByte = start.ReadU8();
601 uint32_t secondByte = start.ReadU8();
602 uint32_t thirdByte = start.ReadU8();
603 uint32_t fourthByte = start.ReadU8();
604 uint32_t encodedFrequency = (secondByte << 16) | (thirdByte << 8) | fourthByte;
616 os <<
"RxParamSetupReq" << std::endl;
617 os <<
"rx1DrOffset: " << unsigned(
m_rx1DrOffset) << std::endl;
618 os <<
"rx2DataRate: " << unsigned(
m_rx2DataRate) << std::endl;
659 : m_rx1DrOffsetAck(rx1DrOffsetAck),
660 m_rx2DataRateAck(rx2DataRateAck),
661 m_channelAck(channelAck)
663 NS_LOG_FUNCTION(
this << rx1DrOffsetAck << rx2DataRateAck << channelAck);
689 uint8_t
byte = start.ReadU8();
703 os <<
"RxParamSetupAns" << std::endl;
746 os <<
"DevStatusReq" << std::endl;
762 : m_battery(battery),
790 m_margin = start.ReadU8() & 0b111111;
800 os <<
"DevStatusAns" << std::endl;
801 os <<
"Battery: " << unsigned(
m_battery) << std::endl;
802 os <<
"Margin: " << unsigned(
m_margin) << std::endl;
837 : m_chIndex(chIndex),
838 m_frequency(frequency),
839 m_minDataRate(minDataRate),
840 m_maxDataRate(maxDataRate)
858 start.WriteU8((encodedFrequency & 0xff0000) >> 16);
859 start.WriteU8((encodedFrequency & 0xff00) >> 8);
860 start.WriteU8(encodedFrequency & 0xff);
874 encodedFrequency |=
uint32_t(start.ReadU16()) << 8;
875 encodedFrequency |=
uint32_t(start.ReadU8());
877 uint8_t dataRateByte = start.ReadU8();
889 os <<
"NewChannelReq" << std::endl;
937 : m_dataRateRangeOk(dataRateRangeOk),
938 m_channelFrequencyOk(channelFrequencyOk)
965 uint8_t
byte = start.ReadU8();
977 os <<
"NewChannelAns" << std::endl;
1022 m_delay = start.ReadU8() & 0xf;
1032 os <<
"RxTimingSetupReq" << std::endl;
1084 os <<
"RxTimingSetupAns" << std::endl;
1124 os <<
"DlChannelAns" << std::endl;
1164 os <<
"TxParamSetupReq" << std::endl;
1204 os <<
"TxParamSetupAns" << std::endl;
iterator in a Buffer instance
A base class which provides memory management and object aggregation.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
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.
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.
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.
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.
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.
LinkAdrAns()
Default constructor.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
bool m_channelMaskAck
The ChannelMaskACK field.
bool m_powerAck
The PowerACK 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.
bool m_dataRateAck
The DataRateACK field.
uint8_t m_nbRep
The NbTrans field.
std::list< int > GetEnabledChannelsList()
Get the list of enabled channels.
uint8_t m_chMaskCntl
The ChMaskCntl field.
uint8_t m_dataRate
The DataRate field, a serializable parameter for setting the spreading factor and bandwidth of end de...
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 GetDataRate()
Return the data rate prescribed by this MAC command.
int GetRepetitions()
Get the number of repetitions prescribed by this MAC command.
uint8_t Deserialize(Buffer::Iterator &start) override
Deserialize the buffer into a MAC command.
uint16_t m_channelMask
The ChMask field.
uint8_t GetTxPower()
Get the transmission power prescribed by this MAC command.
uint8_t m_txPower
The TXPower field, a serializable parameter for setting the transmission power of end devices.
uint8_t GetGwCnt() const
Get the gateway count value.
LinkCheckAns()
Default constructor.
void IncrementGwCnt()
Increment this MacCommand's gwCnt value.
void Print(std::ostream &os) const override
Print the contents of this MAC command in human-readable format.
uint8_t m_gwCnt
This MAC command's gateway count value.
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.
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.
uint8_t GetMargin() const
Get the demodulation margin value.
void Serialize(Buffer::Iterator &start) const override
Serialize the contents of this MAC command into a buffer, according to the LoRaWAN standard.
~LinkCheckReq() override
Destructor.
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.
virtual enum MacCommandType GetCommandType() const
Get the commandType of this MAC command.
virtual uint8_t GetSerializedSize() const
Get serialized length of this MAC command.
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.
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.
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.
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.
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
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.
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.
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.
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.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
MacCommandType
Enum for every possible command type.
Every class exported by the ns3 library is enclosed in the ns3 namespace.