14#include "ns3/pointer.h"
29 TypeId(
"ns3::LoraNetDevice")
31 .AddConstructor<LoraNetDevice>()
32 .SetGroupName(
"lorawan")
33 .AddAttribute(
"Channel",
34 "The channel attached to this device",
39 "The PHY layer attached to this device.",
44 "The MAC layer attached to this device.",
55 m_configComplete(false)
132 return m_phy->GetChannel();
139 return m_phy->GetChannel();
191 return m_phy !=
nullptr;
272 uint16_t protocolNumber)
a polymophic address class
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
Network layer to device interface.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
uint16_t GetMtu() const override
void SetMac(Ptr< LorawanMac > mac)
Set which LorawanMac instance is linked to this device.
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
bool NeedsArp() const override
Ptr< Node > GetNode() const override
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
bool IsMulticast() const override
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
bool IsBridge() const override
Return true if the net device is acting as a bridge.
Ptr< LoraPhy > GetPhy() const
Get the LoraPhy instance that is linked to this NetDevice.
~LoraNetDevice() override
Destructor.
Ptr< LoraChannel > DoGetChannel() const
Return the LoraChannel this device is connected to.
Ptr< LorawanMac > m_mac
The LorawanMac this NetDevice is connected to.
bool SupportsSendFrom() const override
LoraNetDevice()
Default constructor.
bool IsLinkUp() const override
Ptr< Channel > GetChannel() const override
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
void AddLinkChangeCallback(Callback< void > callback) override
void SetAddress(Address address) override
Set the address of this interface.
static TypeId GetTypeId()
Register this type.
Address GetBroadcast() const override
Ptr< LorawanMac > GetMac() const
Get the LorawanMac instance that is linked to this NetDevice.
Ptr< LoraPhy > m_phy
The LoraPhy this NetDevice is connected to.
Ptr< Node > m_node
The Node this NetDevice is connected to.
bool IsBroadcast() const override
void SetIfIndex(const uint32_t index) override
Address GetAddress() const override
bool SetMtu(const uint16_t mtu) override
void Receive(Ptr< Packet > packet)
Callback the Mac layer calls whenever a packet arrives and needs to be forwarded up the stack.
void SetNode(Ptr< Node > node) override
NetDevice::ReceiveCallback m_receiveCallback
Upper layer callback used for notification of new data packet arrivals.
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
bool m_configComplete
Whether the configuration was already completed.
void CompleteConfig()
Complete the configuration of this LoRa device by connecting all lower components (PHY,...
void SetPhy(Ptr< LoraPhy > phy)
Set which LoraPhy instance is linked to this device.
uint32_t GetIfIndex() const override
void Send(Ptr< Packet > packet)
Send a packet through the LoRaWAN stack.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#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_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.