INET Framework for OMNeT++/OMNEST
|
Basic class for all physical layers, please don't touch!! More...
#include <ChannelAccess.h>
Protected Member Functions | |
virtual void | sendToChannel (AirFrame *msg) |
Sends a message to all hosts in range. | |
const Coord & | getMyPosition () |
Returns the host's position. | |
virtual void | initialize (int stage) |
Register with ChannelControl and subscribe to hostPos. | |
virtual int | numInitStages () const |
Divide initialization into two stages. | |
Protected Attributes | |
ChannelControl * | cc |
Pointer to the ChannelControl module. | |
ChannelControl::HostRef | myHostRef |
Identifies this host in the ChannelControl module. |
Basic class for all physical layers, please don't touch!!
This class is not supposed to work on its own, but it contains functions and lists that cooperate with ChannelControl to handle the dynamically created gates. This means EVERY SnrEval (the lowest layer in a host) has to be derived from this class!!!! And please follow the instructions on how to declare a physical layer in a .ned file in "The Design of a Mobility Framework in OMNeT++" paper.
Please don't touch this class.
const Coord& ChannelAccess::getMyPosition | ( | ) | [inline, protected] |
Returns the host's position.
Referenced by BasicSnrEval::encapsMsg(), AbstractRadio::encapsulatePacket(), SnrEval::handleLowerMsgStart(), GilbertElliotSnr::handleLowerMsgStart(), and AbstractRadio::handleLowerMsgStart().
{return cc->getHostPosition(myHostRef);}
void ChannelAccess::initialize | ( | int | stage | ) | [protected, virtual] |
Register with ChannelControl and subscribe to hostPos.
Upon initialization ChannelAccess registers the nic parent module to have all its connections handled by ChannelControl
Reimplemented from BasicModule.
Reimplemented in GilbertElliotSnr, SnrEval, SnrEval80211, BasicSnrEval, and AbstractRadio.
{ BasicModule::initialize(stage); if (stage == 0) { cc = ChannelControl::get(); // register to get a notification when position changes nb->subscribe(this, NF_HOSTPOSITION_UPDATED); } else if (stage == 2) { cModule *hostModule = findHost(); myHostRef = cc->lookupHost(hostModule); if (myHostRef==0) error("host not registered yet in ChannelControl (this should be done by " "the Mobility module -- maybe this host doesn't have one?)"); } }
virtual int ChannelAccess::numInitStages | ( | ) | const [inline, protected, virtual] |
Divide initialization into two stages.
In the first stage (stage==0), modules subscribe to notification categories at NotificationBoard. The first notifications (e.g. about the initial values of some variables such as RadioState) should take place earliest in the second stage (stage==1), when everyone interested in them has already subscribed.
Reimplemented from BasicModule.
{return 3;}
void ChannelAccess::sendToChannel | ( | AirFrame * | msg | ) | [protected, virtual] |
Sends a message to all hosts in range.
This function has to be called whenever a packet is supposed to be sent to the channel.
This function really sends the message away, so if you still want to work with it you should send a duplicate!
Referenced by BasicSnrEval::sendDown(), and AbstractRadio::sendDown().
{ coreEV << "sendToChannel: sending to gates\n"; // delegate it to ChannelControl cc->sendToChannel(this, myHostRef, msg); }
ChannelControl* ChannelAccess::cc [protected] |
Pointer to the ChannelControl module.
Referenced by SnrEval::changeChannel(), AbstractRadio::changeChannel(), SnrEval::initialize(), initialize(), BasicSnrEval::initialize(), AbstractRadio::initialize(), and sendToChannel().
ChannelControl::HostRef ChannelAccess::myHostRef [protected] |
Identifies this host in the ChannelControl module.
Referenced by SnrEval::changeChannel(), AbstractRadio::changeChannel(), SnrEval::initialize(), initialize(), AbstractRadio::initialize(), and sendToChannel().