A Discrete-Event Network Simulator
API
generic-battery-wifiradio-example.cc File Reference
#include <ns3/core-module.h>
#include <ns3/energy-module.h>
#include <ns3/internet-module.h>
#include <ns3/mobility-module.h>
#include <ns3/network-module.h>
#include <ns3/wifi-module.h>
#include <sstream>
#include <string>
+ Include dependency graph for generic-battery-wifiradio-example.cc:

Go to the source code of this file.

Functions

static void GenerateTraffic (Ptr< Socket > socket, uint32_t pktSize, Ptr< Node > n, uint32_t pktCount, Time pktInterval)
 
std::string PrintReceivedPacket (Address &from)
 Print a received packet. More...
 
void ReceivePacket (Ptr< Socket > socket)
 
void RemainingEnergy (double oldValue, double remainingEnergy)
 Trace function for remaining energy at node. More...
 

Function Documentation

◆ GenerateTraffic()

static void GenerateTraffic ( Ptr< Socket socket,
uint32_t  pktSize,
Ptr< Node n,
uint32_t  pktCount,
Time  pktInterval 
)
static
Parameters
socketPointer to socket.
pktSizePacket size.
nPointer to node.
pktCountNumber of packets to generate.
pktIntervalPacket sending interval.

Generate Traffic

Definition at line 101 of file generic-battery-wifiradio-example.cc.

References ns3::Socket::Close(), pktSize, ns3::Simulator::Schedule(), and ns3::Socket::Send().

+ Here is the call graph for this function:

◆ PrintReceivedPacket()

std::string PrintReceivedPacket ( Address from)
inline

Print a received packet.

Parameters
fromsender address
Returns
a string with the details of the packet: dst {IP, port}, time.

Definition at line 61 of file generic-battery-wifiradio-example.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetIpv4(), and ns3::InetSocketAddress::GetPort().

Referenced by ReceivePacket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReceivePacket()

void ReceivePacket ( Ptr< Socket socket)
Parameters
socketPointer to socket.

Packet receiving sink.

Definition at line 78 of file generic-battery-wifiradio-example.cc.

References ns3::Packet::GetSize(), NS_LOG_DEBUG, PrintReceivedPacket(), and ns3::Socket::RecvFrom().

+ Here is the call graph for this function:

◆ RemainingEnergy()

void RemainingEnergy ( double  oldValue,
double  remainingEnergy 
)

Trace function for remaining energy at node.

Parameters
oldValueOld value
remainingEnergyNew value

Definition at line 131 of file generic-battery-wifiradio-example.cc.

References NS_LOG_DEBUG.