MiXiM
2.3
|
This class provides helper function for MAC modules that use the UWB-IR IEEE 802.15.4A model. More...
#include <UWBIRMac.h>
Public Member Functions | |
virtual void | initialize (int stage) |
Initialization of the module and some variables. | |
virtual void | finish () |
Called when the simulation has finished. | |
Protected Member Functions | |
void | prepareData (UWBIRMacPkt *packet, IEEE802154A::config cfg=IEEE802154A::cfg_mandatory_4M) |
virtual void | handleLowerMsg (cMessage *msg) |
bool | validatePacket (UWBIRMacPkt *mac) |
void | initCounters () |
Protected Attributes | |
bool | debug |
Debug switch for all other modules. | |
bool | stats |
bool | trace |
bool | rsDecoder |
bool | packetsAlwaysValid |
double | totalRxBits |
double | errRxBits |
MacToPhyInterface * | phy |
Handler to the physical layer. | |
Packet | packet |
int | prf |
cOutVector | packetsBER |
cOutVector | dataLengths |
cOutVector | erroneousSymbols |
cOutVector | sentPulses |
cOutVector | receivedPulses |
cOutVector | meanPacketBER |
cOutVector | packetSuccessRate |
cOutVector | packetSuccessRateNoRS |
cOutVector | ber |
cStdDev | meanBER |
cOutVector | RSErrorRate |
cOutVector | success |
cOutVector | successNoRS |
long | nbReceivedPacketsNoRS |
long | nbReceivedPacketsRS |
long | nbSentPackets |
long | nbSymbolErrors |
long | nbSymbolsReceived |
long | nbHandledRxPackets |
long | nbFramesDropped |
Private Member Functions | |
UWBIRMac (const UWBIRMac &) | |
Copy constructor is not allowed. | |
UWBIRMac & | operator= (const UWBIRMac &) |
Assignment operator is not allowed. |
This class provides helper function for MAC modules that use the UWB-IR IEEE 802.15.4A model.
Just before sending down a packet to the UWBIRPhyLayer, call prepareData(UWBIRMacPkt* packet). Just after receiving a packet from the UWBIRPhyLayer, call validatePacket(UWBIRMacPkt* packet) and check the returned bool value to know if the packet could be decoded successfully.
void UWBIRMac::handleLowerMsg | ( | cMessage * | msg | ) | [protected, virtual] |
If message arrives from lower layer, check whether it is for us. Send it up if yes.
This basic implementation just forwards all message that are broadcast (destAddr = L2BROADCAST) or destined for this node (destAddr = nic module getId()) to the network layer
Reimplemented from BaseMacLayer.
Reimplemented in AlohaMacLayer.
{ UWBIRMacPkt *mac = static_cast<UWBIRMacPkt *> (msg); if (validatePacket(mac)) { const LAddress::L2Type& dest = mac->getDestAddr(); const LAddress::L2Type& src = mac->getSrcAddr(); if ((dest == myMacAddr)) { debugEV<< "message with mac addr " << src << " for me (dest=" << dest << ") -> forward packet to upper layer" << std::endl; sendUp(decapsMsg(mac)); } else { debugEV << "message with mac addr " << src << " not for me (dest=" << dest << ") -> delete (my MAC=" << myMacAddr << ")" << std::endl; delete mac; } } else { debugEV << "Errors in message ; dropping mac packet." << std::endl; delete mac; } }
void UWBIRMac::initialize | ( | int | stage | ) | [virtual] |
Initialization of the module and some variables.
First we have to initialize the module from which we derived ours, in this case BaseLayer.
Reimplemented from BaseMacLayer.
Reimplemented in AlohaMacLayer.
References BaseLayer::catDroppedPacketSignal, simsignalwrap_t::initialize(), and BaseMacLayer::initialize().
Referenced by AlohaMacLayer::initialize().
{ BaseMacLayer::initialize(stage); if (stage == 0) { BaseLayer::catDroppedPacketSignal.initialize(); debug = par("debug").boolValue(); stats = par("stats").boolValue(); trace = par("trace").boolValue(); prf = par("PRF"); assert(prf == 4 || prf == 16); packetsAlwaysValid = par("packetsAlwaysValid"); rsDecoder = par("RSDecoder").boolValue(); phy = FindModule<MacToPhyInterface*>::findSubModule( this->getNic() ); initCounters(); } }