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 waitTime) override |
Find the minimum wait 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. | |
uint32_t | GetSecondReceiveWindowFrequency () const |
Get the frequency that is used for the second receive window. | |
void | OnRxParamSetupReq (uint8_t rx1DrOffset, uint8_t rx2DataRate, double frequencyHz) 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 (uint32_t frequencyHz) |
Set the frequency that will be used for the second receive window. | |
void | TxFinished (Ptr< const Packet > packet) override |
Perform the actions that are required after a packet send. | |
![]() | |
EndDeviceLorawanMac () | |
Default constructor. | |
~EndDeviceLorawanMac () override | |
Destructor. | |
void | AddMacCommand (Ptr< MacCommand > macCommand) |
Add a MAC command to the list of those that will be sent out in the next packet. | |
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 () |
Get the aggregated duty cycle. | |
uint8_t | GetDataRate () |
Get the data rate this end device is set to use. | |
LoraDeviceAddress | GetDeviceAddress () |
Get the network address of this device. | |
uint8_t | GetLastKnownGatewayCount () const |
Get the last known number of gateways concurrently receiving transmissions from the device. | |
uint8_t | GetLastKnownLinkMarginDb () const |
Get the last known link margin from the demodulation floor. | |
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. | |
double | GetTransmissionPowerDbm () |
Get the transmission power this end device is set to use. | |
bool | GetUplinkAdrBit () const |
Get the current value of the device's uplink ADR bit of the LoRaWAN FHDR. | |
void | OnDevStatusReq () |
Perform the actions that need to be taken when receiving a DevStatusReq command. | |
void | OnDutyCycleReq (uint8_t maxDutyCycle) |
Perform the actions that need to be taken when receiving a DutyCycleReq command. | |
void | OnLinkAdrReq (uint8_t dataRate, uint8_t txPower, uint16_t chMask, uint8_t chMaskCntl, uint8_t nbTrans) |
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, uint32_t frequencyHz, uint8_t minDataRate, uint8_t maxDataRate) |
Perform the actions that need to be taken when receiving a NewChannelReq 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 from the lower layer. | |
virtual void | resetRetransmissionParameters () |
Reset retransmission parameters contained in the structure LoraRetxParams. | |
void | Send (Ptr< Packet > packet) override |
Send a packet. | |
void | SetDataRate (uint8_t dataRate) |
Set the data rate this end device will use when transmitting. | |
void | SetDeviceAddress (LoraDeviceAddress address) |
Set the network address of this device. | |
void | SetMaxNumberOfTransmissions (uint8_t nbTrans) |
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 | SetTransmissionPowerDbm (double txPowerDbm) |
Set the transmission power of this end device. | |
void | SetUplinkAdrBit (bool adr) |
Signals to the network server that this device will or may not comply with LinkADRReq settings (data rate, transmission power and number of retransmissions) received in downlink. | |
void | TxFinished (Ptr< const Packet > packet) override |
Perform actions after sending a packet. | |
![]() | |
LorawanMac () | |
Default constructor. | |
~LorawanMac () override | |
Destructor. | |
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. | |
Ptr< 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. | |
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 (Ptr< 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. | |
![]() | |
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 final |
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. | |
![]() | |
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. | |
![]() | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) 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. | |
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 TypeId | GetTypeId () |
Register this type. | |
![]() | |
static TypeId | GetTypeId () |
Register this type. | |
![]() | |
static TypeId | GetTypeId () |
Register this type. | |
![]() | |
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. | |
uint32_t | m_secondReceiveWindowFrequencyHz |
The frequency [Hz] to listen on for the second receive window. | |
Additional Inherited Members | |
![]() | |
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. | |
![]() | |
Ptr< LogicalLoraChannel > | GetChannelForTx () |
Find a suitable channel for transmission. | |
![]() | |
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. | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
![]() | |
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. | |
double | m_lastRxSnr |
Used to record the last reception SNR measurement to be included in the DevStatusAns. | |
std::list< Ptr< MacCommand > > | m_macCommandList |
List of the MAC commands that need to be applied to the next UL packet. | |
uint8_t | m_nbTrans |
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_txPowerDbm |
The transmission ERP [dBm] this device is currently using. | |
Ptr< UniformRandomVariable > | m_uniformRV |
An uniform random variable, used to randomly pick from the channel list. | |
![]() | |
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. | |
Ptr< 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. | |
![]() | |
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 33 of file class-a-end-device-lorawan-mac.h.
ns3::lorawan::ClassAEndDeviceLorawanMac::ClassAEndDeviceLorawanMac | ( | ) |
Default constructor.
Definition at line 40 of file class-a-end-device-lorawan-mac.cc.
References m_closeFirstWindow, m_closeSecondWindow, m_receiveDelay1, m_receiveDelay2, m_rx1DrOffset, m_secondReceiveWindow, NS_LOG_FUNCTION, and ns3::Seconds().
Referenced by GetTypeId().
|
override |
Destructor.
Definition at line 58 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 313 of file class-a-end-device-lorawan-mac.cc.
References ns3::DynamicCast(), 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 379 of file class-a-end-device-lorawan-mac.cc.
References ns3::DynamicCast(), ns3::lorawan::EndDeviceLorawanMac::m_nbTrans, 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::resetRetransmissionParameters(), ns3::lorawan::EndDeviceLoraPhy::RX, ns3::lorawan::EndDeviceLorawanMac::Send(), ns3::lorawan::EndDeviceLoraPhy::SLEEP, ns3::lorawan::EndDeviceLoraPhy::STANDBY, and ns3::lorawan::EndDeviceLoraPhy::TX.
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 239 of file class-a-end-device-lorawan-mac.cc.
References ns3::DynamicCast(), ns3::lorawan::EndDeviceLorawanMac::m_nbTrans, 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::resetRetransmissionParameters(), and ns3::lorawan::EndDeviceLorawanMac::Send().
uint8_t ns3::lorawan::ClassAEndDeviceLorawanMac::GetFirstReceiveWindowDataRate | ( | ) |
Get the data rate that will be used in the first receive window.
Definition at line 495 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 wait time before the next possible transmission based on end device's Class Type.
waitTime | The minimum wait 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 451 of file class-a-end-device-lorawan-mac.cc.
References ns3::Time::As(), ns3::lorawan::LorawanMac::GetBandwidthFromDataRate(), GetSecondReceiveWindowDataRate(), ns3::lorawan::LorawanMac::GetSfFromDataRate(), m_closeFirstWindow, m_closeSecondWindow, ns3::lorawan::EndDeviceLorawanMac::m_receiveWindowDurationInSymbols, ns3::lorawan::EndDeviceLorawanMac::m_retxParams, m_secondReceiveWindow, ns3::lorawan::EndDeviceLorawanMac::m_uniformRV, Max, ns3::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION_NOARGS, NS_LOG_WARN, ns3::Time::S, and ns3::Seconds().
uint8_t ns3::lorawan::ClassAEndDeviceLorawanMac::GetSecondReceiveWindowDataRate | ( | ) | const |
Get the data rate that will be used in the second receive window.
Definition at line 507 of file class-a-end-device-lorawan-mac.cc.
References m_secondReceiveWindowDataRate.
Referenced by GetNextClassTransmissionDelay(), and OpenSecondReceiveWindow().
uint32_t ns3::lorawan::ClassAEndDeviceLorawanMac::GetSecondReceiveWindowFrequency | ( | ) | const |
Get the frequency that is used for the second receive window.
Definition at line 519 of file class-a-end-device-lorawan-mac.cc.
References m_secondReceiveWindowFrequencyHz.
|
static |
Register this type.
Definition at line 31 of file class-a-end-device-lorawan-mac.cc.
References ClassAEndDeviceLorawanMac(), ns3::lorawan::EndDeviceLorawanMac::EndDeviceLorawanMac(), and ns3::TypeId::SetParent().
|
overridevirtual |
Perform the actions that need to be taken when receiving a RxParamSetupReq command based on the Device's Class Type.
rx1DrOffset | The first reception window data rate offset to set. |
rx2DataRate | The data rate to use for the second receive window. |
frequencyHz | The frequency [Hz] to use for the second receive window. |
Implements ns3::lorawan::EndDeviceLorawanMac.
Definition at line 529 of file class-a-end-device-lorawan-mac.cc.
References ns3::Create(), ns3::lorawan::LorawanMac::GetBandwidthFromDataRate(), ns3::lorawan::LorawanMac::GetSfFromDataRate(), ns3::lorawan::LorawanMac::m_channelHelper, ns3::lorawan::EndDeviceLorawanMac::m_dataRate, ns3::lorawan::EndDeviceLorawanMac::m_macCommandList, ns3::lorawan::LorawanMac::m_replyDataRateMatrix, m_rx1DrOffset, m_secondReceiveWindowDataRate, m_secondReceiveWindowFrequencyHz, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_WARN.
void ns3::lorawan::ClassAEndDeviceLorawanMac::OpenFirstReceiveWindow | ( | ) |
Perform operations needed to open the first receive window.
Definition at line 293 of file class-a-end-device-lorawan-mac.cc.
References CloseFirstReceiveWindow(), ns3::DynamicCast(), 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 342 of file class-a-end-device-lorawan-mac.cc.
References CloseSecondReceiveWindow(), ns3::DynamicCast(), ns3::lorawan::LorawanMac::GetBandwidthFromDataRate(), GetSecondReceiveWindowDataRate(), ns3::lorawan::LorawanMac::GetSfFromDataRate(), m_closeSecondWindow, ns3::lorawan::LorawanMac::m_phy, ns3::lorawan::EndDeviceLorawanMac::m_receiveWindowDurationInSymbols, m_secondReceiveWindowDataRate, m_secondReceiveWindowFrequencyHz, 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 132 of file class-a-end-device-lorawan-mac.cc.
References ns3::Simulator::Cancel(), ns3::DynamicCast(), ns3::lorawan::LoraFrameHeader::GetAddress(), ns3::lorawan::LoraTag::GetReceivePower(), ns3::lorawan::LorawanMacHeader::IsUplink(), ns3::lorawan::EndDeviceLorawanMac::m_address, ns3::lorawan::EndDeviceLorawanMac::m_lastRxSnr, ns3::lorawan::EndDeviceLorawanMac::m_nbTrans, 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::ParseCommands(), ns3::lorawan::EndDeviceLorawanMac::resetRetransmissionParameters(), ns3::lorawan::EndDeviceLorawanMac::Send(), and ns3::lorawan::LoraFrameHeader::SetAsDownlink().
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 68 of file class-a-end-device-lorawan-mac.cc.
References ns3::DynamicCast(), ns3::lorawan::LorawanMac::GetBandwidthFromDataRate(), ns3::lorawan::EndDeviceLorawanMac::GetChannelForTx(), GetFirstReceiveWindowDataRate(), ns3::lorawan::LoraPhy::GetOnAirTime(), 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_nbTrans, ns3::lorawan::LorawanMac::m_nPreambleSymbols, ns3::lorawan::LorawanMac::m_phy, ns3::lorawan::EndDeviceLorawanMac::m_retxParams, m_rx1DrOffset, ns3::lorawan::EndDeviceLorawanMac::m_txPowerDbm, ns3::MilliSeconds(), and NS_LOG_DEBUG.
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 501 of file class-a-end-device-lorawan-mac.cc.
References m_secondReceiveWindowDataRate.
void ns3::lorawan::ClassAEndDeviceLorawanMac::SetSecondReceiveWindowFrequency | ( | uint32_t | frequencyHz | ) |
Set the frequency that will be used for the second receive window.
frequencyHz | The Frequency. |
Definition at line 513 of file class-a-end-device-lorawan-mac.cc.
References m_secondReceiveWindowFrequencyHz.
|
overridevirtual |
Perform the actions that are required after a packet send.
This function handles opening of the first receive window.
packet | The packet that has just been transmitted. |
Implements ns3::lorawan::LorawanMac.
Definition at line 268 of file class-a-end-device-lorawan-mac.cc.
References ns3::DynamicCast(), 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 177 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 184 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 163 of file class-a-end-device-lorawan-mac.h.
Referenced by ClassAEndDeviceLorawanMac(), and TxFinished().
|
private |
The interval between when a packet is done sending and when the second receive window is opened.
Definition at line 170 of file class-a-end-device-lorawan-mac.h.
Referenced by ClassAEndDeviceLorawanMac(), and TxFinished().
|
private |
The RX1DROffset parameter value.
Definition at line 207 of file class-a-end-device-lorawan-mac.h.
Referenced by ClassAEndDeviceLorawanMac(), GetFirstReceiveWindowDataRate(), OnRxParamSetupReq(), 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 192 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 202 of file class-a-end-device-lorawan-mac.h.
Referenced by GetSecondReceiveWindowDataRate(), OnRxParamSetupReq(), OpenSecondReceiveWindow(), and SetSecondReceiveWindowDataRate().
|
private |
The frequency [Hz] to listen on for the second receive window.
Definition at line 197 of file class-a-end-device-lorawan-mac.h.
Referenced by GetSecondReceiveWindowFrequency(), OnRxParamSetupReq(), OpenSecondReceiveWindow(), and SetSecondReceiveWindowFrequency().