Class representing the MAC layer of a Class A LoRaWAN device. More...
#include "class-a-end-device-lorawan-mac.h"
Public Member Functions | |
ClassAEndDeviceLorawanMac () | |
Default constructor. | |
~ClassAEndDeviceLorawanMac () override | |
Destructor. | |
void | CloseFirstReceiveWindow () |
Perform operations needed to close the first receive window. | |
void | CloseSecondReceiveWindow () |
Perform operations needed to close the second receive window. | |
void | FailedReception (Ptr< const Packet > packet) override |
Function called by lower layers to inform this layer that reception of a packet we were locked on failed. | |
uint8_t | GetFirstReceiveWindowDataRate () |
Get the data rate that will be used in the first receive window. | |
Time | GetNextClassTransmissionDelay (Time waitingTime) override |
Find the minimum waiting time before the next possible transmission based on end device's Class Type. | |
uint8_t | GetSecondReceiveWindowDataRate () const |
Get the data rate that will be used in the second receive window. | |
double | GetSecondReceiveWindowFrequency () const |
Get the frequency that is used for the second receive window. | |
void | OnRxClassParamSetupReq (Ptr< RxParamSetupReq > rxParamSetupReq) override |
Perform the actions that need to be taken when receiving a RxParamSetupReq command based on the Device's Class Type. | |
void | OpenFirstReceiveWindow () |
Perform operations needed to open the first receive window. | |
void | OpenSecondReceiveWindow () |
Perform operations needed to open the second receive window. | |
void | Receive (Ptr< const Packet > packet) override |
Receive a packet. | |
void | SendToPhy (Ptr< Packet > packet) override |
Add headers and send a packet with the sending function of the physical layer. | |
void | SetSecondReceiveWindowDataRate (uint8_t dataRate) |
Set the data rate to be used in the second receive window. | |
void | SetSecondReceiveWindowFrequency (double frequencyMHz) |
Set the frequency that will be used for the second receive window. | |
void | TxFinished (Ptr< const Packet > packet) override |
Perform actions after sending a packet. | |
Public Member Functions inherited from ns3::lorawan::EndDeviceLorawanMac | |
EndDeviceLorawanMac () | |
Default constructor. | |
~EndDeviceLorawanMac () override | |
Destructor. | |
void | AddLogicalChannel (double frequency) |
Add a logical channel to the helper. | |
void | AddLogicalChannel (Ptr< LogicalLoraChannel > logicalChannel) |
Add a logical channel to the helper. | |
void | AddMacCommand (Ptr< MacCommand > macCommand) |
Add a MAC command to the list of those that will be sent out in the next packet. | |
void | AddSubBand (double startFrequency, double endFrequency, double dutyCycle, double maxTxPowerDbm) |
Add a subband to the logical channel helper. | |
void | ApplyNecessaryOptions (LoraFrameHeader &frameHeader) |
Add the necessary options and MAC commands to the LoraFrameHeader. | |
void | ApplyNecessaryOptions (LorawanMacHeader &macHeader) |
Add the necessary options and MAC commands to the LorawanMacHeader. | |
virtual void | DoSend (Ptr< Packet > packet) |
Checking if we are performing the transmission of a new packet or a retransmission, and call SendToPhy function. | |
void | FailedReception (Ptr< const Packet > packet) override |
Function called by lower layers to inform this layer that reception of a packet we were locked on failed. | |
double | GetAggregatedDutyCycle () |
** | |
uint8_t | GetDataRate () |
Get the data rate this end device is set to use. | |
bool | GetDataRateAdaptation () const |
Get if data rate adaptation is enabled or not. | |
LoraDeviceAddress | GetDeviceAddress () |
Get the network address of this device. | |
uint8_t | GetMaxNumberOfTransmissions () |
Get the max number of unacknowledged redundant transmissions of each packet. | |
LorawanMacHeader::MType | GetMType () |
Get the message type to send when the Send method is called. | |
virtual uint8_t | GetTransmissionPower () |
Get the transmission power this end device is set to use. | |
void | OnDevStatusReq () |
Perform the actions that need to be taken when receiving a DevStatusReq command. | |
void | OnDutyCycleReq (double dutyCycle) |
Perform the actions that need to be taken when receiving a DutyCycleReq command. | |
void | OnLinkAdrReq (uint8_t dataRate, uint8_t txPower, std::list< int > enabledChannels, int repetitions) |
Perform the actions that need to be taken when receiving a LinkAdrReq command. | |
void | OnLinkCheckAns (uint8_t margin, uint8_t gwCnt) |
Perform the actions that need to be taken when receiving a LinkCheckAns command. | |
void | OnNewChannelReq (uint8_t chIndex, double frequency, uint8_t minDataRate, uint8_t maxDataRate) |
Perform the actions that need to be taken when receiving a NewChannelReq command. | |
virtual void | OnRxClassParamSetupReq (Ptr< RxParamSetupReq > rxParamSetupReq) |
Perform the actions that need to be taken when receiving a RxParamSetupReq command based on the Device's Class Type. | |
void | OnRxParamSetupReq (Ptr< RxParamSetupReq > rxParamSetupReq) |
Perform the actions that need to be taken when receiving a RxParamSetupReq command. | |
void | ParseCommands (LoraFrameHeader frameHeader) |
Parse and take action on the commands contained on this FrameHeader. | |
virtual void | postponeTransmission (Time nextTxDelay, Ptr< Packet > packet) |
Postpone transmission to the specified time and delete previously scheduled transmissions if present. | |
void | Receive (Ptr< const Packet > packet) override |
Receive a packet. | |
virtual void | resetRetransmissionParameters () |
Reset retransmission parameters contained in the structure LoraRetxParams. | |
void | Send (Ptr< Packet > packet) override |
Send a packet. | |
virtual void | SendToPhy (Ptr< Packet > packet) |
Add headers and send a packet with the sending function of the physical layer. | |
void | SetDataRate (uint8_t dataRate) |
Set the data rate this end device will use when transmitting. | |
void | SetDataRateAdaptation (bool adapt) |
Enable data rate adaptation in the retransmitting procedure. | |
void | SetDeviceAddress (LoraDeviceAddress address) |
Set the network address of this device. | |
void | SetLogicalChannel (uint8_t chIndex, double frequency, uint8_t minDataRate, uint8_t maxDataRate) |
Set a new logical channel in the helper. | |
void | SetMaxNumberOfTransmissions (uint8_t maxNumbTx) |
Set the max number of unacknowledged redundant transmissions of each packet. | |
void | SetMType (LorawanMacHeader::MType mType) |
Set the message type to send when the Send method is called. | |
void | TxFinished (Ptr< const Packet > packet) override |
Perform the actions that are required after a packet send. | |
Public Member Functions inherited from ns3::lorawan::LorawanMac | |
LorawanMac () | |
Default constructor. | |
~LorawanMac () override | |
Destructor. | |
virtual void | FailedReception (Ptr< const Packet > packet)=0 |
Function called by lower layers to inform this layer that reception of a packet we were locked on failed. | |
double | GetBandwidthFromDataRate (uint8_t dataRate) |
Get the bandwidth corresponding to a data rate, based on this MAC's region. | |
double | GetDbmForTxPower (uint8_t txPower) |
Get the transmission power in dBm that corresponds, in this region, to the encoded 8-bit txPower. | |
Ptr< NetDevice > | GetDevice () |
Get the device this MAC layer is installed on. | |
LogicalLoraChannelHelper | GetLogicalLoraChannelHelper () |
Get the logical lora channel helper associated with this MAC. | |
int | GetNPreambleSymbols () const |
Get the number of PHY preamble symbols this MAC is set to use. | |
Ptr< LoraPhy > | GetPhy () |
Get the underlying PHY layer. | |
uint8_t | GetSfFromDataRate (uint8_t dataRate) |
Get the spreading factor corresponding to a data rate, based on this MAC's region. | |
virtual void | Receive (Ptr< const Packet > packet)=0 |
Receive a packet from the lower layer. | |
virtual void | Send (Ptr< Packet > packet)=0 |
Send a packet. | |
void | SetBandwidthForDataRate (std::vector< double > bandwidthForDataRate) |
Set the vector to use to check up correspondence between bandwidth and data rate. | |
void | SetDevice (Ptr< NetDevice > device) |
Set the device this MAC layer is installed on. | |
void | SetLogicalLoraChannelHelper (LogicalLoraChannelHelper helper) |
Set the LogicalLoraChannelHelper this MAC instance will use. | |
void | SetMaxAppPayloadForDataRate (std::vector< uint32_t > maxAppPayloadForDataRate) |
Set the maximum App layer payload for a set data rate. | |
void | SetNPreambleSymbols (int nPreambleSymbols) |
Set the number of PHY preamble symbols this MAC is set to use. | |
void | SetPhy (Ptr< LoraPhy > phy) |
Set the underlying PHY layer. | |
void | SetReplyDataRateMatrix (ReplyDataRateMatrix replyDataRateMatrix) |
Set the matrix to use when deciding with which data rate to respond. | |
void | SetSfForDataRate (std::vector< uint8_t > sfForDataRate) |
Set the vector to use to check up correspondence between spreading factor and data rate. | |
void | SetTxDbmForTxPower (std::vector< double > txDbmForTxPower) |
Set the vector to use to check up which transmission power in Dbm corresponds to a certain TxPower value in this MAC's region. | |
virtual void | TxFinished (Ptr< const Packet > packet)=0 |
Perform actions after sending a packet. | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
virtual TypeId | GetInstanceTypeId () const =0 |
Get the most derived TypeId for this Object. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::lorawan::EndDeviceLorawanMac | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::lorawan::LorawanMac | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Private Attributes | |
EventId | m_closeFirstWindow |
The event of the closing the first receive window. | |
EventId | m_closeSecondWindow |
The event of the closing the second receive window. | |
Time | m_receiveDelay1 |
The interval between when a packet is done sending and when the first receive window is opened. | |
Time | m_receiveDelay2 |
The interval between when a packet is done sending and when the second receive window is opened. | |
uint8_t | m_rx1DrOffset |
The RX1DROffset parameter value. | |
EventId | m_secondReceiveWindow |
The event of the second receive window opening. | |
uint8_t | m_secondReceiveWindowDataRate |
The data rate to listen for during the second downlink transmission. | |
double | m_secondReceiveWindowFrequency |
The frequency to listen on for the second receive window. | |
Additional Inherited Members | |
Public Types inherited from ns3::lorawan::LorawanMac | |
typedef std::array< std::array< uint8_t, 6 >, 8 > | ReplyDataRateMatrix |
Matrix structure to store possible data rate value to be used by a LoRaWAN end device for listening during the RX1 receive window. | |
Protected Member Functions inherited from ns3::lorawan::EndDeviceLorawanMac | |
Ptr< LogicalLoraChannel > | GetChannelForTx () |
Find a suitable channel for transmission. | |
virtual Time | GetNextClassTransmissionDelay (Time waitingTime) |
Find the minimum waiting time before the next possible transmission based on end device's Class Type. | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | DoInitialize () |
Initialize() implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Protected Attributes inherited from ns3::lorawan::EndDeviceLorawanMac | |
LoraDeviceAddress | m_address |
The address of this device. | |
uint8_t | m_codingRate |
The coding rate used by this device. | |
TracedValue< uint8_t > | m_dataRate |
The data rate this device is using to transmit. | |
bool | m_enableDRAdapt |
Enable data rate adaptation (ADR) during the retransmission procedure. | |
bool | m_headerDisabled |
Whether or not the LoRa PHY header is disabled for communications by this device. | |
std::list< Ptr< MacCommand > > | m_macCommandList |
List of the MAC commands that need to be applied to the next UL packet. | |
uint8_t | m_maxNumbTx |
Default number of unacknowledged redundant transmissions of each packet. | |
uint8_t | m_receiveWindowDurationInSymbols |
The duration of a receive window in number of symbols. | |
TracedCallback< uint8_t, bool, Time, Ptr< Packet > > | m_requiredTxCallback |
The trace source fired when the transmission procedure is finished. | |
struct LoraRetxParameters | m_retxParams |
Structure containing the retransmission parameters for this device. | |
TracedValue< double > | m_txPower |
The transmission power this device is using to transmit. | |
Ptr< UniformRandomVariable > | m_uniformRV |
An uniform random variable, used by the Shuffle method to randomly reorder the channel list. | |
Protected Attributes inherited from ns3::lorawan::LorawanMac | |
std::vector< double > | m_bandwidthForDataRate |
A vector holding the bandwidth each data rate corresponds to. | |
TracedCallback< Ptr< const Packet > > | m_cannotSendBecauseDutyCycle |
The trace source that is fired when a packet cannot be sent because of duty cycle limitations. | |
LogicalLoraChannelHelper | m_channelHelper |
The LogicalLoraChannelHelper instance that is assigned to this MAC. | |
Ptr< NetDevice > | m_device |
The device this MAC layer is installed on. | |
std::vector< uint32_t > | m_maxAppPayloadForDataRate |
A vector holding the maximum app payload size that corresponds to a certain data rate. | |
int | m_nPreambleSymbols |
The number of symbols to use in the PHY preamble. | |
Ptr< LoraPhy > | m_phy |
The PHY instance that sits under this MAC layer. | |
TracedCallback< Ptr< const Packet > > | m_receivedPacket |
Trace source that is fired when a packet reaches the MAC layer. | |
ReplyDataRateMatrix | m_replyDataRateMatrix |
The matrix that decides the data rate the gateway will use in a reply based on the end device's sending data rate and on the value of the RX1DROffset parameter. | |
TracedCallback< Ptr< const Packet > > | m_sentNewPacket |
Trace source that is fired when a new APP layer packet arrives at the MAC layer. | |
std::vector< uint8_t > | m_sfForDataRate |
A vector holding the spreading factor each data rate corresponds to. | |
std::vector< double > | m_txDbmForTxPower |
A vector holding the power that corresponds to a certain TxPower value. | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Class representing the MAC layer of a Class A LoRaWAN device.
Definition at line 44 of file class-a-end-device-lorawan-mac.h.
ns3::lorawan::ClassAEndDeviceLorawanMac::ClassAEndDeviceLorawanMac | ( | ) |
Default constructor.
Definition at line 52 of file class-a-end-device-lorawan-mac.cc.
References ns3::EventId::Cancel(), m_closeFirstWindow, m_closeSecondWindow, m_secondReceiveWindow, and NS_LOG_FUNCTION.
|
override |
Destructor.
Definition at line 70 of file class-a-end-device-lorawan-mac.cc.
References NS_LOG_FUNCTION_NOARGS.
void ns3::lorawan::ClassAEndDeviceLorawanMac::CloseFirstReceiveWindow | ( | ) |
Perform operations needed to close the first receive window.
Definition at line 320 of file class-a-end-device-lorawan-mac.cc.
References ns3::lorawan::LorawanMac::m_phy, NS_ABORT_MSG, NS_LOG_FUNCTION_NOARGS, ns3::lorawan::EndDeviceLoraPhy::RX, ns3::lorawan::EndDeviceLoraPhy::SLEEP, ns3::lorawan::EndDeviceLoraPhy::STANDBY, and ns3::lorawan::EndDeviceLoraPhy::TX.
Referenced by OpenFirstReceiveWindow().
void ns3::lorawan::ClassAEndDeviceLorawanMac::CloseSecondReceiveWindow | ( | ) |
Perform operations needed to close the second receive window.
Definition at line 387 of file class-a-end-device-lorawan-mac.cc.
References ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::firstAttempt, ns3::lorawan::EndDeviceLoraPhy::GetState(), ns3::lorawan::EndDeviceLorawanMac::m_maxNumbTx, ns3::lorawan::LorawanMac::m_phy, ns3::lorawan::EndDeviceLorawanMac::m_requiredTxCallback, ns3::lorawan::EndDeviceLorawanMac::m_retxParams, NS_ABORT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION_NOARGS, NS_LOG_INFO, ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::packet, ns3::lorawan::EndDeviceLorawanMac::resetRetransmissionParameters(), ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::retxLeft, ns3::lorawan::EndDeviceLoraPhy::RX, ns3::lorawan::EndDeviceLorawanMac::Send(), ns3::lorawan::EndDeviceLoraPhy::SLEEP, ns3::lorawan::EndDeviceLoraPhy::STANDBY, ns3::lorawan::EndDeviceLoraPhy::TX, and ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::waitingAck.
Referenced by OpenSecondReceiveWindow().
|
overridevirtual |
Function called by lower layers to inform this layer that reception of a packet we were locked on failed.
packet | The packet we failed to receive. |
Implements ns3::lorawan::LorawanMac.
Definition at line 246 of file class-a-end-device-lorawan-mac.cc.
References ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::firstAttempt, ns3::EventId::IsExpired(), ns3::lorawan::EndDeviceLorawanMac::m_maxNumbTx, ns3::lorawan::LorawanMac::m_phy, ns3::lorawan::EndDeviceLorawanMac::m_requiredTxCallback, ns3::lorawan::EndDeviceLorawanMac::m_retxParams, m_secondReceiveWindow, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::packet, ns3::lorawan::EndDeviceLorawanMac::resetRetransmissionParameters(), ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::retxLeft, ns3::lorawan::EndDeviceLorawanMac::Send(), and ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::waitingAck.
uint8_t ns3::lorawan::ClassAEndDeviceLorawanMac::GetFirstReceiveWindowDataRate | ( | ) |
Get the data rate that will be used in the first receive window.
Definition at line 503 of file class-a-end-device-lorawan-mac.cc.
References ns3::lorawan::EndDeviceLorawanMac::m_dataRate, ns3::lorawan::LorawanMac::m_replyDataRateMatrix, and m_rx1DrOffset.
Referenced by OpenFirstReceiveWindow(), and SendToPhy().
|
overridevirtual |
Find the minimum waiting time before the next possible transmission based on end device's Class Type.
waitingTime | The minimum waiting time that has to be respected, irrespective of the class (e.g., because of duty cycle limitations). |
Reimplemented from ns3::lorawan::EndDeviceLorawanMac.
Definition at line 459 of file class-a-end-device-lorawan-mac.cc.
References ns3::lorawan::LorawanMac::GetBandwidthFromDataRate(), GetSecondReceiveWindowDataRate(), ns3::Time::GetSeconds(), ns3::lorawan::LorawanMac::GetSfFromDataRate(), ns3::EventId::GetTs(), ns3::UniformRandomVariable::GetValue(), ns3::EventId::IsExpired(), m_closeFirstWindow, m_closeSecondWindow, ns3::lorawan::EndDeviceLorawanMac::m_receiveWindowDurationInSymbols, ns3::lorawan::EndDeviceLorawanMac::m_retxParams, m_secondReceiveWindow, ns3::lorawan::EndDeviceLorawanMac::m_uniformRV, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION_NOARGS, NS_LOG_WARN, ns3::Seconds(), and ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::waitingAck.
uint8_t ns3::lorawan::ClassAEndDeviceLorawanMac::GetSecondReceiveWindowDataRate | ( | ) | const |
Get the data rate that will be used in the second receive window.
Definition at line 515 of file class-a-end-device-lorawan-mac.cc.
References m_secondReceiveWindowDataRate.
Referenced by GetNextClassTransmissionDelay(), and OpenSecondReceiveWindow().
double ns3::lorawan::ClassAEndDeviceLorawanMac::GetSecondReceiveWindowFrequency | ( | ) | const |
Get the frequency that is used for the second receive window.
Definition at line 527 of file class-a-end-device-lorawan-mac.cc.
References m_secondReceiveWindowFrequency.
|
static |
Register this type.
Definition at line 43 of file class-a-end-device-lorawan-mac.cc.
References ns3::TypeId::SetParent().
|
overridevirtual |
Perform the actions that need to be taken when receiving a RxParamSetupReq command based on the Device's Class Type.
rxParamSetupReq | The Parameter Setup Request, which contains:
|
Reimplemented from ns3::lorawan::EndDeviceLorawanMac.
Definition at line 537 of file class-a-end-device-lorawan-mac.cc.
References ns3::lorawan::LorawanMac::GetBandwidthFromDataRate(), ns3::lorawan::LorawanMac::GetSfFromDataRate(), ns3::lorawan::EndDeviceLorawanMac::m_macCommandList, m_rx1DrOffset, m_secondReceiveWindowDataRate, m_secondReceiveWindowFrequency, NS_LOG_FUNCTION, and NS_LOG_INFO.
void ns3::lorawan::ClassAEndDeviceLorawanMac::OpenFirstReceiveWindow | ( | ) |
Perform operations needed to open the first receive window.
Definition at line 300 of file class-a-end-device-lorawan-mac.cc.
References CloseFirstReceiveWindow(), ns3::lorawan::LorawanMac::GetBandwidthFromDataRate(), GetFirstReceiveWindowDataRate(), ns3::lorawan::LorawanMac::GetSfFromDataRate(), m_closeFirstWindow, ns3::lorawan::LorawanMac::m_phy, ns3::lorawan::EndDeviceLorawanMac::m_receiveWindowDurationInSymbols, NS_LOG_FUNCTION_NOARGS, ns3::Simulator::Schedule(), and ns3::Seconds().
Referenced by TxFinished().
void ns3::lorawan::ClassAEndDeviceLorawanMac::OpenSecondReceiveWindow | ( | ) |
Perform operations needed to open the second receive window.
Definition at line 350 of file class-a-end-device-lorawan-mac.cc.
References CloseSecondReceiveWindow(), ns3::lorawan::LorawanMac::GetBandwidthFromDataRate(), GetSecondReceiveWindowDataRate(), ns3::lorawan::LorawanMac::GetSfFromDataRate(), ns3::lorawan::EndDeviceLoraPhy::GetState(), m_closeSecondWindow, ns3::lorawan::LorawanMac::m_phy, ns3::lorawan::EndDeviceLorawanMac::m_receiveWindowDurationInSymbols, m_secondReceiveWindowDataRate, m_secondReceiveWindowFrequency, NS_LOG_FUNCTION_NOARGS, NS_LOG_INFO, ns3::lorawan::EndDeviceLoraPhy::RX, ns3::Simulator::Schedule(), and ns3::Seconds().
Referenced by TxFinished().
Receive a packet.
This method is typically registered as a callback in the underlying PHY layer so that it's called when a packet is going up the stack.
packet | The received packet. |
Implements ns3::lorawan::LorawanMac.
Definition at line 144 of file class-a-end-device-lorawan-mac.cc.
References ns3::Simulator::Cancel(), ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::firstAttempt, ns3::lorawan::LoraFrameHeader::GetAddress(), ns3::EventId::IsExpired(), ns3::lorawan::LorawanMacHeader::IsUplink(), ns3::lorawan::EndDeviceLorawanMac::m_address, ns3::lorawan::EndDeviceLorawanMac::m_maxNumbTx, ns3::lorawan::LorawanMac::m_phy, ns3::lorawan::LorawanMac::m_receivedPacket, ns3::lorawan::EndDeviceLorawanMac::m_requiredTxCallback, ns3::lorawan::EndDeviceLorawanMac::m_retxParams, m_secondReceiveWindow, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::packet, ns3::lorawan::EndDeviceLorawanMac::ParseCommands(), ns3::lorawan::EndDeviceLorawanMac::resetRetransmissionParameters(), ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::retxLeft, ns3::lorawan::EndDeviceLorawanMac::Send(), ns3::lorawan::LoraFrameHeader::SetAsDownlink(), and ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::waitingAck.
Add headers and send a packet with the sending function of the physical layer.
packet | The packet to send. |
Reimplemented from ns3::lorawan::EndDeviceLorawanMac.
Definition at line 80 of file class-a-end-device-lorawan-mac.cc.
References ns3::lorawan::LogicalLoraChannelHelper::AddEvent(), ns3::lorawan::LorawanMac::GetBandwidthFromDataRate(), ns3::lorawan::EndDeviceLorawanMac::GetChannelForTx(), GetFirstReceiveWindowDataRate(), ns3::lorawan::LorawanMac::GetSfFromDataRate(), ns3::lorawan::LoraPhy::GetTSym(), ns3::lorawan::LorawanMac::m_channelHelper, ns3::lorawan::EndDeviceLorawanMac::m_codingRate, ns3::lorawan::EndDeviceLorawanMac::m_dataRate, ns3::lorawan::EndDeviceLorawanMac::m_enableDRAdapt, ns3::lorawan::EndDeviceLorawanMac::m_headerDisabled, ns3::lorawan::EndDeviceLorawanMac::m_maxNumbTx, ns3::lorawan::LorawanMac::m_nPreambleSymbols, ns3::lorawan::LorawanMac::m_phy, ns3::lorawan::EndDeviceLorawanMac::m_retxParams, m_rx1DrOffset, ns3::lorawan::EndDeviceLorawanMac::m_txPower, ns3::MilliSeconds(), NS_LOG_DEBUG, and ns3::lorawan::EndDeviceLorawanMac::LoraRetxParameters::retxLeft.
void ns3::lorawan::ClassAEndDeviceLorawanMac::SetSecondReceiveWindowDataRate | ( | uint8_t | dataRate | ) |
Set the data rate to be used in the second receive window.
dataRate | The data rate. |
Definition at line 509 of file class-a-end-device-lorawan-mac.cc.
References m_secondReceiveWindowDataRate.
void ns3::lorawan::ClassAEndDeviceLorawanMac::SetSecondReceiveWindowFrequency | ( | double | frequencyMHz | ) |
Set the frequency that will be used for the second receive window.
frequencyMHz | The Frequency. |
Definition at line 521 of file class-a-end-device-lorawan-mac.cc.
References m_secondReceiveWindowFrequency.
|
overridevirtual |
Perform actions after sending a packet.
packet | The packet that just finished transmission. |
Implements ns3::lorawan::LorawanMac.
Definition at line 275 of file class-a-end-device-lorawan-mac.cc.
References ns3::lorawan::LorawanMac::m_phy, m_receiveDelay1, m_receiveDelay2, m_secondReceiveWindow, NS_LOG_FUNCTION_NOARGS, OpenFirstReceiveWindow(), OpenSecondReceiveWindow(), and ns3::Simulator::Schedule().
|
private |
The event of the closing the first receive window.
This Event will be canceled if there's a successful reception of a packet.
Definition at line 184 of file class-a-end-device-lorawan-mac.h.
Referenced by ClassAEndDeviceLorawanMac(), GetNextClassTransmissionDelay(), and OpenFirstReceiveWindow().
|
private |
The event of the closing the second receive window.
This Event will be canceled if there's a successful reception of a packet.
Definition at line 191 of file class-a-end-device-lorawan-mac.h.
Referenced by ClassAEndDeviceLorawanMac(), GetNextClassTransmissionDelay(), and OpenSecondReceiveWindow().
|
private |
The interval between when a packet is done sending and when the first receive window is opened.
Definition at line 170 of file class-a-end-device-lorawan-mac.h.
Referenced by TxFinished().
|
private |
The interval between when a packet is done sending and when the second receive window is opened.
Definition at line 177 of file class-a-end-device-lorawan-mac.h.
Referenced by TxFinished().
|
private |
The RX1DROffset parameter value.
Definition at line 214 of file class-a-end-device-lorawan-mac.h.
Referenced by GetFirstReceiveWindowDataRate(), OnRxClassParamSetupReq(), and SendToPhy().
|
private |
The event of the second receive window opening.
This Event is used to cancel the second window in case the first one is successful.
Definition at line 199 of file class-a-end-device-lorawan-mac.h.
Referenced by ClassAEndDeviceLorawanMac(), FailedReception(), GetNextClassTransmissionDelay(), Receive(), and TxFinished().
|
private |
The data rate to listen for during the second downlink transmission.
Definition at line 209 of file class-a-end-device-lorawan-mac.h.
Referenced by GetSecondReceiveWindowDataRate(), OnRxClassParamSetupReq(), OpenSecondReceiveWindow(), and SetSecondReceiveWindowDataRate().
|
private |
The frequency to listen on for the second receive window.
Definition at line 204 of file class-a-end-device-lorawan-mac.h.
Referenced by GetSecondReceiveWindowFrequency(), OnRxClassParamSetupReq(), OpenSecondReceiveWindow(), and SetSecondReceiveWindowFrequency().