|
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.
Definition at line 47 of file ChannelAccess.h.
| const Coord& ChannelAccess::getMyPosition | ( | ) | [inline, protected] |
Returns the host's position.
Definition at line 61 of file ChannelAccess.h.
Referenced by BasicSnrEval::encapsMsg(), AbstractRadio::encapsulatePacket(), GilbertElliotSnr::handleLowerMsgStart(), AbstractRadio::handleLowerMsgStart(), and SnrEval::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 BasicSnrEval, SnrEval, AbstractRadio, GilbertElliotSnr, and SnrEval80211.
Definition at line 30 of file ChannelAccess.cc.
{
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.
Definition at line 67 of file ChannelAccess.h.
{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!
Definition at line 59 of file ChannelAccess.cc.
Referenced by AbstractRadio::sendDown(), and BasicSnrEval::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.
Definition at line 51 of file ChannelAccess.h.
Referenced by SnrEval::changeChannel(), AbstractRadio::changeChannel(), AbstractRadio::initialize(), initialize(), SnrEval::initialize(), BasicSnrEval::initialize(), and sendToChannel().
ChannelControl::HostRef ChannelAccess::myHostRef [protected] |
Identifies this host in the ChannelControl module.
Definition at line 54 of file ChannelAccess.h.
Referenced by SnrEval::changeChannel(), AbstractRadio::changeChannel(), AbstractRadio::initialize(), initialize(), SnrEval::initialize(), and sendToChannel().