INET Framework for OMNeT++/OMNEST
AbstractRadio Class Reference

#include <AbstractRadio.h>

Inheritance diagram for AbstractRadio:
ChannelAccess BasicModule INotifiable GenericRadio Ieee80211Radio

List of all members.

Classes

struct  SnrStruct

Public Member Functions

 AbstractRadio ()
virtual ~AbstractRadio ()

Protected Types

typedef std::map< AirFrame
*, double > 
RecvBuff

Protected Member Functions

virtual void initialize (int stage)
 Register with ChannelControl and subscribe to hostPos.
virtual void finish ()
virtual void handleMessage (cMessage *msg)
virtual void handleUpperMsg (AirFrame *)
virtual void handleSelfMsg (cMessage *)
virtual void handleCommand (int msgkind, cPolymorphic *ctrl)
virtual void handleLowerMsgStart (AirFrame *airframe)
 Buffer the frame and update noise levels and snr information.
virtual void handleLowerMsgEnd (AirFrame *airframe)
 Unbuffer the frame and update noise levels and snr information.
virtual void bufferMsg (AirFrame *airframe)
 Buffers message for 'transmission time'.
virtual AirFrame * unbufferMsg (cMessage *msg)
 Unbuffers a message after 'transmission time'.
virtual void sendUp (AirFrame *airframe)
virtual void sendDown (AirFrame *airframe)
virtual AirFrame * encapsulatePacket (cPacket *msg)
virtual void setRadioState (RadioState::State newState)
virtual int getChannelNumber () const
virtual void addNewSnr ()
virtual AirFrame * createAirFrame ()
virtual void changeChannel (int channel)
virtual void setBitrate (double bitrate)
virtual IReceptionModelcreateReceptionModel ()=0
virtual IRadioModelcreateRadioModel ()=0

Protected Attributes

IRadioModelradioModel
IReceptionModelreceptionModel
double transmitterPower
SnrStruct snrInfo
RecvBuff recvBuff
RadioState rs
int newChannel
double newBitrate
double noiseLevel
double carrierFrequency
double thermalNoise
double sensitivity
Gate Ids
int uppergateOut
int uppergateIn

Detailed Description

Abstract base class for radio modules. Radio modules deal with the transmission of frames over a wireless medium (the radio channel). See the Radio module's NED documentation for an overview of radio modules.

This class implements common functionality of the radio, and abstracts out specific parts into two interfaces, IReceptionModel and IRadioModel. The reception model is responsible for modelling path loss, interference and antenna gain. The radio model is responsible for calculating frame duration, and modelling modulation scheme and possible forward error correction. Subclasses have to redefine the createReceptionModel() and createRadioModel() methods to create and return appropriate reception model and radio model objects.

History

The implementation is largely based on the Mobility Framework's SnrEval and Decider modules. They have been merged into a single module, multi-channel support, runtime channel and bitrate switching capability added, and all code specific to the physical channel and radio characteristics have been factored out into the IReceptionModel and IRadioModel classes.

Author:
Andras Varga, Levente Meszaros

Member Typedef Documentation

typedef std::map<AirFrame*,double> AbstractRadio::RecvBuff [protected]

Typedef used to store received messages together with receive power.


Constructor & Destructor Documentation

AbstractRadio::AbstractRadio ( )
                             : rs(this->getId())
{
    radioModel = NULL;
    receptionModel = NULL;
}
AbstractRadio::~AbstractRadio ( ) [virtual]
{
    delete radioModel;
    delete receptionModel;

    // delete messages being received
    for (RecvBuff::iterator it = recvBuff.begin(); it!=recvBuff.end(); ++it)
        delete it->first;
}

Member Function Documentation

void AbstractRadio::addNewSnr ( ) [protected, virtual]

Updates the SNR information of the relevant AirFrame

Referenced by handleLowerMsgEnd(), and handleLowerMsgStart().

{
    SnrListEntry listEntry;     // create a new entry
    listEntry.time = simTime();
    listEntry.snr = snrInfo.rcvdPower / noiseLevel;
    snrInfo.sList.push_back(listEntry);
}
void AbstractRadio::bufferMsg ( AirFrame *  airframe) [protected, virtual]

Buffers message for 'transmission time'.

The packet is put in a buffer for the time the transmission would last in reality. A timer indicates when the transmission is complete. So, look at unbufferMsg to see what happens when the transmission is complete..

Referenced by changeChannel(), and handleMessage().

{
    // set timer to indicate transmission is complete
    cMessage *endRxTimer = new cMessage("endRx", MK_RECEPTION_COMPLETE);
    endRxTimer->setContextPointer(airframe);
    airframe->setContextPointer(endRxTimer);

    // NOTE: use arrivalTime instead of simTime, because we might be calling this
    // function during a channel change, when we're picking up ongoing transmissions
    // on the channel -- and then the message's arrival time is in the past!
    scheduleAt(airframe->getArrivalTime() + airframe->getDuration(), endRxTimer);
}
void AbstractRadio::changeChannel ( int  channel) [protected, virtual]

Change transmitter and receiver to a new channel. This method throws an error if the radio state is transmit. Messages that are already sent to the new channel and would reach us in the future - thus they are on the air - will be received correctly.

Referenced by handleCommand(), and handleSelfMsg().

{
    if (channel == rs.getChannelNumber())
        return;
    if (channel < 0 || channel >= cc->getNumChannels())
        error("changeChannel(): channel number %d is out of range (hint: numChannels is a parameter of ChannelControl)", channel);
    if (rs.getState() == RadioState::TRANSMIT)
        error("changing channel while transmitting is not allowed");

    // if we are currently receiving, must clean that up before moving to different channel
    if (rs.getState() == RadioState::RECV)
    {
        // delete messages being received, and cancel associated self-messages
        for (RecvBuff::iterator it = recvBuff.begin(); it!=recvBuff.end(); ++it)
        {
            AirFrame *airframe = it->first;
            cMessage *endRxTimer = (cMessage *)airframe->getContextPointer();
            delete airframe;
            delete cancelEvent(endRxTimer);
        }
        recvBuff.clear();
    }

    // clear snr info
    snrInfo.ptr = NULL;
    snrInfo.sList.clear();

    // do channel switch
    EV << "Changing to channel #" << channel << "\n";

    rs.setChannelNumber(channel);
    cc->updateHostChannel(myHostRef, channel);
    ChannelControl::TransmissionList tl = cc->getOngoingTransmissions(channel);

    cModule *myHost = findHost();
    cGate *radioGate = myHost->gate("radioIn");

    // pick up ongoing transmissions on the new channel
    EV << "Picking up ongoing transmissions on new channel:\n";
    for (ChannelControl::TransmissionList::const_iterator it = tl.begin(); it != tl.end(); ++it)
    {
        AirFrame *airframe = *it;
        // time for the message to reach us
        double distance = myHostRef->pos.distance(airframe->getSenderPos());
        simtime_t propagationDelay = distance / LIGHT_SPEED;

        // if this transmission is on our new channel and it would reach us in the future, then schedule it
        if (channel == airframe->getChannelNumber())
        {
            EV << " - (" << airframe->getClassName() << ")" << airframe->getName() << ": ";

            // if there is a message on the air which will reach us in the future
            if (airframe->getTimestamp() + propagationDelay >= simTime())
            {
                 EV << "will arrive in the future, scheduling it\n";

                 // we need to send to each radioIn[] gate of this host
                 for (int i = 0; i < radioGate->size(); i++)
                     sendDirect(airframe->dup(), airframe->getTimestamp() + propagationDelay - simTime(), airframe->getDuration(), myHost, radioGate->getId() + i);
            }
            // if we hear some part of the message
            else if (airframe->getTimestamp() + airframe->getDuration() + propagationDelay > simTime())
            {
                 EV << "missed beginning of frame, processing it as noise\n";

                 AirFrame *frameDup = airframe->dup();
                 frameDup->setArrivalTime(airframe->getTimestamp() + propagationDelay);
                 handleLowerMsgStart(frameDup);
                 bufferMsg(frameDup);
            }
            else
            {
                EV << "in the past\n";
            }
        }
    }

    // notify other modules about the channel switch; and actually, radio state has changed too
    nb->fireChangeNotification(NF_RADIO_CHANNEL_CHANGED, &rs);
    nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs);
}
virtual AirFrame* AbstractRadio::createAirFrame ( ) [inline, protected, virtual]

Create a new AirFrame

Referenced by encapsulatePacket().

{return new AirFrame();}
virtual IRadioModel* AbstractRadio::createRadioModel ( ) [protected, pure virtual]

To be defined to provide a radio model. The radio model is responsible for calculating frame duration, and modelling modulation scheme and possible forward error correction.

Implemented in GenericRadio, and Ieee80211Radio.

Referenced by initialize().

virtual IReceptionModel* AbstractRadio::createReceptionModel ( ) [protected, pure virtual]

To be defined to provide a reception model. The reception model is responsible for modelling path loss, interference and antenna gain.

Implemented in GenericRadio, and Ieee80211Radio.

Referenced by initialize().

AirFrame * AbstractRadio::encapsulatePacket ( cPacket *  msg) [protected, virtual]

Encapsulates a MAC frame into an Air Frame

Referenced by handleMessage().

{
    PhyControlInfo *ctrl = dynamic_cast<PhyControlInfo *>(frame->removeControlInfo());
    ASSERT(!ctrl || ctrl->getChannelNumber()==-1); // per-packet channel switching not supported

    // Note: we don't set length() of the AirFrame, because duration will be used everywhere instead
    AirFrame *airframe = createAirFrame();
    airframe->setName(frame->getName());
    airframe->setPSend(transmitterPower);
    airframe->setChannelNumber(getChannelNumber());
    airframe->encapsulate(frame);
    airframe->setBitrate(ctrl ? ctrl->getBitrate() : rs.getBitrate());
    airframe->setDuration(radioModel->calculateDuration(airframe));
    airframe->setSenderPos(getMyPosition());
    delete ctrl;

    EV << "Frame (" << frame->getClassName() << ")" << frame->getName()
       << " will be transmitted at " << (airframe->getBitrate()/1e6) << "Mbps\n";
    return airframe;
}
void AbstractRadio::finish ( ) [protected, virtual]
{
}
virtual int AbstractRadio::getChannelNumber ( ) const [inline, protected, virtual]

Returns the current channel the radio is tuned to

Referenced by encapsulatePacket(), and handleMessage().

{return rs.getChannelNumber();}
void AbstractRadio::handleCommand ( int  msgkind,
cPolymorphic *  ctrl 
) [protected, virtual]

Referenced by handleMessage().

{
    if (msgkind==PHY_C_CONFIGURERADIO)
    {
        // extract new channel number
        PhyControlInfo *phyCtrl = check_and_cast<PhyControlInfo *>(ctrl);
        int newChannel = phyCtrl->getChannelNumber();
        double newBitrate = phyCtrl->getBitrate();
        delete ctrl;

        if (newChannel!=-1)
        {
            EV << "Command received: change to channel #" << newChannel << "\n";

            // do it
            if (rs.getChannelNumber()==newChannel)
                EV << "Right on that channel, nothing to do\n"; // fine, nothing to do
            else if (rs.getState()==RadioState::TRANSMIT) {
                EV << "We're transmitting right now, remembering to change after it's completed\n";
                this->newChannel = newChannel;
            } else
                changeChannel(newChannel); // change channel right now
        }
        if (newBitrate!=-1)
        {
            EV << "Command received: change bitrate to " << (newBitrate/1e6) << "Mbps\n";

            // do it
            if (rs.getBitrate()==newBitrate)
                EV << "Right at that bitrate, nothing to do\n"; // fine, nothing to do
            else if (rs.getState()==RadioState::TRANSMIT) {
                EV << "We're transmitting right now, remembering to change after it's completed\n";
                this->newBitrate = newBitrate;
            } else
                setBitrate(newBitrate); // change bitrate right now
        }
    }
    else
    {
        error("unknown command (msgkind=%d)", msgkind);
    }
}
void AbstractRadio::handleLowerMsgEnd ( AirFrame *  airframe) [protected, virtual]

Unbuffer the frame and update noise levels and snr information.

This function is called right after the transmission is over, i.e. right after unbuffering. The noise level of the channel and the snr information of the buffered messages have to be updated.

Additionally the RadioState has to be updated.

If the corresponding AirFrame was not only noise the corresponding SnrList and the AirFrame are sent to the decider.

Referenced by handleSelfMsg().

{
    // check if message has to be send to the decider
    if (snrInfo.ptr == airframe)
    {
        EV << "reception of frame over, preparing to send packet to upper layer\n";
        // get Packet and list out of the receive buffer:
        SnrList list;
        list = snrInfo.sList;

        // delete the pointer to indicate that no message is currently
        // being received and clear the list
        snrInfo.ptr = NULL;
        snrInfo.sList.clear();

        // delete the frame from the recvBuff
        recvBuff.erase(airframe);

        //XXX send up the frame:
        //if (radioModel->isReceivedCorrectly(airframe, list))
        //    sendUp(airframe);
        //else
        //    delete airframe;
        if (!radioModel->isReceivedCorrectly(airframe, list))
        {
            airframe->getEncapsulatedPacket()->setKind(list.size()>1 ? COLLISION : BITERROR);
            airframe->setName(list.size()>1 ? "COLLISION" : "BITERROR");
        }
        sendUp(airframe);
    }
    // all other messages are noise
    else
    {
        EV << "reception of noise message over, removing recvdPower from noiseLevel....\n";
        // get the rcvdPower and subtract it from the noiseLevel
        noiseLevel -= recvBuff[airframe];

        // delete message from the recvBuff
        recvBuff.erase(airframe);

        // update snr info for message currently being received if any
        if (snrInfo.ptr != NULL)
        {
            addNewSnr();
        }

        // message should be deleted
        delete airframe;
        EV << "message deleted\n";
    }

    // check the RadioState and update if necessary
    // change to idle if noiseLevel smaller than threshold and state was
    // not idle before
    // do not change state if currently sending or receiving a message!!!
    if (noiseLevel < sensitivity && rs.getState() == RadioState::RECV && snrInfo.ptr == NULL)
    {
        // publish the new RadioState:
        EV << "new RadioState is IDLE\n";
        setRadioState(RadioState::IDLE);
    }
}
void AbstractRadio::handleLowerMsgStart ( AirFrame *  airframe) [protected, virtual]

Buffer the frame and update noise levels and snr information.

This function is called right after a packet arrived, i.e. right before it is buffered for 'transmission time'.

First the receive power of the packet has to be calculated and is stored in the recvBuff. Afterwards it has to be decided whether the packet is just noise or a "real" packet that needs to be received.

The message is not treated as noise if all of the following conditions apply:

  1. the power of the received signal is higher than the sensitivity.
  2. the host is currently not sending a message
  3. no other packet is already being received

If all conditions apply a new SnrList is created and the RadioState is changed to RECV.

If the packet is just noise the receive power is added to the noise Level of the channel. Additionally the snr information of the currently being received message (if any) has to be updated as well as the RadioState.

Referenced by changeChannel(), and handleMessage().

{
    // Calculate the receive power of the message

    // calculate distance
    const Coord& myPos = getMyPosition();
    const Coord& framePos = airframe->getSenderPos();
    double distance = myPos.distance(framePos);

    // calculate receive power
    double rcvdPower = receptionModel->calculateReceivedPower(airframe->getPSend(), carrierFrequency, distance);

    // store the receive power in the recvBuff
    recvBuff[airframe] = rcvdPower;

    // if receive power is bigger than sensitivity and if not sending
    // and currently not receiving another message and the message has
    // arrived in time
    // NOTE: a message may have arrival time in the past here when we are
    // processing ongoing transmissions during a channel change
    if (airframe->getArrivalTime() == simTime() && rcvdPower >= sensitivity && rs.getState() != RadioState::TRANSMIT && snrInfo.ptr == NULL)
    {
        EV << "receiving frame " << airframe->getName() << endl;

        // Put frame and related SnrList in receive buffer
        SnrList snrList;
        snrInfo.ptr = airframe;
        snrInfo.rcvdPower = rcvdPower;
        snrInfo.sList = snrList;

        // add initial snr value
        addNewSnr();

        if (rs.getState() != RadioState::RECV)
        {
            // publish new RadioState
            EV << "publish new RadioState:RECV\n";
            setRadioState(RadioState::RECV);
        }
    }
    // receive power is too low or another message is being sent or received
    else
    {
        EV << "frame " << airframe->getName() << " is just noise\n";
        //add receive power to the noise level
        noiseLevel += rcvdPower;

        // if a message is being received add a new snr value
        if (snrInfo.ptr != NULL)
        {
            // update snr info for currently being received message
            EV << "adding new snr value to snr list of message being received\n";
            addNewSnr();
        }

        // update the RadioState if the noiseLevel exceeded the threshold
        // and the radio is currently not in receive or in send mode
        if (noiseLevel >= sensitivity && rs.getState() == RadioState::IDLE)
        {
            EV << "setting radio state to RECV\n";
            setRadioState(RadioState::RECV);
        }
    }
}
void AbstractRadio::handleMessage ( cMessage *  msg) [protected, virtual]

The basic handle message function.

Depending on the gate a message arrives handleMessage just calls different handle*Msg functions to further process the message.

Messages from the channel are also buffered here in order to simulate a transmission delay

You should not make any changes in this function but implement all your functionality into the handle*Msg functions called from here.

See also:
handleUpperMsg, handleLowerMsgStart, handleLowerMsgEnd, handleSelfMsg
{
    // handle commands
    if (msg->getArrivalGateId()==uppergateIn && !msg->isPacket() /*FIXME XXX ENSURE REALLY PLAIN cMessage ARE SENT AS COMMANDS!!! && msg->getBitLength()==0*/)
    {
        cPolymorphic *ctrl = msg->removeControlInfo();
        if (msg->getKind()==0)
            error("Message '%s' with length==0 is supposed to be a command, but msg kind is also zero", msg->getName());
        handleCommand(msg->getKind(), ctrl);
        delete msg;
        return;
    }

    if (msg->getArrivalGateId() == uppergateIn)
    {
        AirFrame *airframe = encapsulatePacket(PK(msg));
        handleUpperMsg(airframe);
    }
    else if (msg->isSelfMessage())
    {
        handleSelfMsg(msg);
    }
    else if (check_and_cast<AirFrame *>(msg)->getChannelNumber() == getChannelNumber())
    {
        // must be an AirFrame
        AirFrame *airframe = (AirFrame *) msg;
        handleLowerMsgStart(airframe);
        bufferMsg(airframe);
    }
    else
    {
        EV << "listening to different channel when receiving message -- dropping it\n";
        delete msg;
    }
}
void AbstractRadio::handleSelfMsg ( cMessage *  msg) [protected, virtual]

Referenced by handleMessage().

{
    if (msg->getKind()==MK_RECEPTION_COMPLETE)
    {
        EV << "frame is completely received now\n";

        // unbuffer the message
        AirFrame *airframe = unbufferMsg(msg);

        handleLowerMsgEnd(airframe);
    }
    else if (msg->getKind() == MK_TRANSMISSION_OVER)
    {
        // Transmission has completed. The RadioState has to be changed
        // to IDLE or RECV, based on the noise level on the channel.
        // If the noise level is bigger than the sensitivity switch to receive mode,
        // otherwise to idle mode.
        if (noiseLevel < sensitivity)
        {
            // set the RadioState to IDLE
            EV << "transmission over, switch to idle mode (state:IDLE)\n";
            setRadioState(RadioState::IDLE);
        }
        else
        {
            // set the RadioState to RECV
            EV << "transmission over but noise level too high, switch to recv mode (state:RECV)\n";
            setRadioState(RadioState::RECV);
        }

        // delete the timer
        delete msg;

        // switch channel if it needs be
        if (newChannel!=-1)
        {
            changeChannel(newChannel);
            newChannel = -1;
        }
    }
    else
    {
        error("Internal error: unknown self-message `%s'", msg->getName());
    }
}
void AbstractRadio::handleUpperMsg ( AirFrame *  airframe) [protected, virtual]

If a message is already being transmitted, an error is raised.

Otherwise the RadioState is set to TRANSMIT and a timer is started. When this timer expires the RadioState will be set back to RECV (or IDLE respectively) again.

If the host is receiving a packet this packet is from now on only considered as noise.

Referenced by handleMessage().

{
    if (rs.getState() == RadioState::TRANSMIT)
        error("Trying to send a message while already transmitting -- MAC should "
              "take care this does not happen");

    // if a packet was being received, it is corrupted now as should be treated as noise
    if (snrInfo.ptr != NULL)
    {
        EV << "Sending a message while receiving another. The received one is now corrupted.\n";

        // remove the snr information stored for the message currently being
        // received. This message is treated as noise now and the
        // receive power has to be added to the noiseLevel

        // delete the pointer to indicate that no message is being received
        snrInfo.ptr = NULL;
        // clear the snr list
        snrInfo.sList.clear();
        // add the receive power to the noise level
        noiseLevel += snrInfo.rcvdPower;
    }

    // now we are done with all the exception handling and can take care
    // about the "real" stuff

    // change radio status
    EV << "sending, changing RadioState to TRANSMIT\n";
    setRadioState(RadioState::TRANSMIT);

    cMessage *timer = new cMessage(NULL, MK_TRANSMISSION_OVER);
    scheduleAt(simTime() + airframe->getDuration(), timer);
    sendDown(airframe);
}
void AbstractRadio::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 ChannelAccess.

{
    ChannelAccess::initialize(stage);

    EV << "Initializing AbstractRadio, stage=" << stage << endl;

    if (stage == 0)
    {
        gate("radioIn")->setDeliverOnReceptionStart(true);

        uppergateIn = findGate("uppergateIn");
        uppergateOut = findGate("uppergateOut");

        // read parameters
        transmitterPower = par("transmitterPower");
        if (transmitterPower > (double) (cc->par("pMax")))
            error("transmitterPower cannot be bigger than pMax in ChannelControl!");
        rs.setBitrate(par("bitrate"));
        rs.setChannelNumber(par("channelNumber"));
        thermalNoise = FWMath::dBm2mW(par("thermalNoise"));
        carrierFrequency = cc->par("carrierFrequency");  // taken from ChannelControl
        sensitivity = FWMath::dBm2mW(par("sensitivity"));

        // initialize noiseLevel
        noiseLevel = thermalNoise;

        EV << "Initialized channel with noise: " << noiseLevel << " sensitivity: " << sensitivity <<
            endl;

        // initialize the pointer of the snrInfo with NULL to indicate
        // that currently no message is received
        snrInfo.ptr = NULL;

        // no channel switch pending
        newChannel = -1;

        // Initialize radio state. If thermal noise is already to high, radio
        // state has to be initialized as RECV
        rs.setState(RadioState::IDLE);
        if (noiseLevel >= sensitivity)
            rs.setState(RadioState::RECV);

        WATCH(noiseLevel);
        WATCH(rs);

        receptionModel = createReceptionModel();
        receptionModel->initializeFrom(this);

        radioModel = createRadioModel();
        radioModel->initializeFrom(this);
    }
    else if (stage == 1)
    {
        // tell initial values to MAC; must be done in stage 1, because they
        // subscribe in stage 0
        nb->fireChangeNotification(NF_RADIOSTATE_CHANGED, &rs);
        nb->fireChangeNotification(NF_RADIO_CHANNEL_CHANGED, &rs);
    }
    else if (stage == 2)
    {
        // tell initial channel number to ChannelControl; should be done in
        // stage==2 or later, because base class initializes myHostRef in that stage
        cc->updateHostChannel(myHostRef, rs.getChannelNumber());
    }
}
void AbstractRadio::sendDown ( AirFrame *  airframe) [protected, virtual]

Sends a message to the channel

Referenced by handleUpperMsg().

{
    sendToChannel(airframe);
}
void AbstractRadio::sendUp ( AirFrame *  airframe) [protected, virtual]

Sends a message to the upper layer

Referenced by handleLowerMsgEnd().

{
    cPacket *frame = airframe->decapsulate();
    delete airframe;
    EV << "sending up frame " << frame->getName() << endl;
    send(frame, uppergateOut);
}
void AbstractRadio::setBitrate ( double  bitrate) [protected, virtual]

Change the bitrate to the given value. This method throws an error if the radio state is transmit.

Referenced by handleCommand().

{
    if (rs.getBitrate() == bitrate)
        return;
    if (bitrate < 0)
        error("setBitrate(): bitrate cannot be negative (%g)", bitrate);
    if (rs.getState() == RadioState::TRANSMIT)
        error("changing the bitrate while transmitting is not allowed");

    EV << "Setting bitrate to " << (bitrate/1e6) << "Mbps\n";
    rs.setBitrate(bitrate);

    //XXX fire some notification?
}
void AbstractRadio::setRadioState ( RadioState::State  newState) [protected, virtual]

Sets the radio state, and also fires change notification

Referenced by handleLowerMsgEnd(), handleLowerMsgStart(), handleSelfMsg(), and handleUpperMsg().

AirFrame * AbstractRadio::unbufferMsg ( cMessage *  msg) [protected, virtual]

Unbuffers a message after 'transmission time'.

Get the context pointer to the now completely received AirFrame and delete the self message

Referenced by handleSelfMsg().

{
    AirFrame *airframe = (AirFrame *) msg->getContextPointer();
    //delete the self message
    delete msg;

    return airframe;
}

Member Data Documentation

double AbstractRadio::carrierFrequency [protected]

Configuration: The carrier frequency used. It is read from the ChannelControl module.

Referenced by handleLowerMsgStart(), and initialize().

double AbstractRadio::newBitrate [protected]

State: if not -1, we have to switch to that bitrate once we finished transmitting

Referenced by handleCommand().

int AbstractRadio::newChannel [protected]

State: if not -1, we have to switch to that channel once we finished transmitting

Referenced by handleCommand(), handleSelfMsg(), and initialize().

double AbstractRadio::noiseLevel [protected]

State: the current noise level of the channel.

Referenced by addNewSnr(), handleLowerMsgEnd(), handleLowerMsgStart(), handleSelfMsg(), handleUpperMsg(), and initialize().

State: A buffer to store a pointer to a message and the related receive power.

Referenced by changeChannel(), handleLowerMsgEnd(), handleLowerMsgStart(), and ~AbstractRadio().

double AbstractRadio::sensitivity [protected]

Configuration: Defines up to what Power level (in dBm) a message can be understood. If the level of a received packet is lower, it is only treated as noise. Can be specified in omnetpp.ini. Default: -85 dBm

Referenced by handleLowerMsgEnd(), handleLowerMsgStart(), handleSelfMsg(), and initialize().

State: SnrInfo stores the snrList and the the recvdPower for the message currently being received, together with a pointer to the message.

Referenced by addNewSnr(), changeChannel(), handleLowerMsgEnd(), handleLowerMsgStart(), handleUpperMsg(), and initialize().

double AbstractRadio::thermalNoise [protected]

Configuration: Thermal noise on the channel. Can be specified in omnetpp.ini. Default: -100 dBm

Referenced by initialize().

double AbstractRadio::transmitterPower [protected]

Power used to transmit messages

Referenced by encapsulatePacket(), and initialize().

int AbstractRadio::uppergateIn [protected]

Referenced by handleMessage(), and initialize().

int AbstractRadio::uppergateOut [protected]

Referenced by initialize(), and sendUp().


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