INET Framework for OMNeT++/OMNEST
ChannelAccess Class Reference

Basic class for all physical layers, please don't touch!! More...

#include <ChannelAccess.h>

Inheritance diagram for ChannelAccess:
BasicModule INotifiable AbstractRadio BasicSnrEval GenericRadio Ieee80211Radio SnrEval GilbertElliotSnr SnrEval80211

List of all members.

Protected Member Functions

virtual void sendToChannel (AirFrame *msg)
 Sends a message to all hosts in range.
const CoordgetMyPosition ()
 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

ChannelControlcc
 Pointer to the ChannelControl module.
ChannelControl::HostRef myHostRef
 Identifies this host in the ChannelControl module.

Detailed Description

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.

Author:
Marc L�bbers

Member Function Documentation

const Coord& ChannelAccess::getMyPosition ( ) [inline, protected]
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);
}

Member Data Documentation


The documentation for this class was generated from the following files: