Public Member Functions | Protected Member Functions | Protected Attributes

Decider80211MultiChannel Class Reference

Extends Decider80211 by multi channel support. More...

#include <Decider80211MultiChannel.h>

Inherits Decider80211Battery.

Collaboration diagram for Decider80211MultiChannel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Decider80211MultiChannel (DeciderToPhyInterface *phy, double threshold, double sensitivity, double decodingCurrentDelta, int currentChannel, int myIndex=-1, bool debug=false)
 Initializes this Decider with the passed values.
virtual void channelChanged (int newChannel)
 Called by phy layer to indicate that the channel this radio currently listens to has changed.

Protected Member Functions

virtual void getChannelInfo (simtime_t start, simtime_t end, AirFrameVector &out)
 Collects the AirFrame on the channel during the passed interval.
virtual simtime_t processNewSignal (AirFrame *frame)
 Filters AirFrames on other channels than the current one.
virtual DeciderResultcheckIfSignalOk (AirFrame *frame)
 Checks if the passed completed AirFrame was received correctly.

Protected Attributes

int currentChannel

Detailed Description

Extends Decider80211 by multi channel support.

Filters processing of AirFrames depending on the channel they were sent on and the channel this deciders radio is currently set to. All AirFrames on another channel than the currently used one are ignored totally, they are neither received nor considered as interference. If the channel changed during the reception of an AirFrame the AirFrame is considered lost, independent from the size of the part which was lost due to channel change.

NOTE: This decider does not model interference between adjacent channels!

Author:
Karl Wessel

Definition at line 29 of file Decider80211MultiChannel.h.


Constructor & Destructor Documentation

Decider80211MultiChannel::Decider80211MultiChannel ( DeciderToPhyInterface phy,
double  threshold,
double  sensitivity,
double  decodingCurrentDelta,
int  currentChannel,
int  myIndex = -1,
bool  debug = false 
)

Initializes this Decider with the passed values.

Parameters:
phy Pointer to this deciders phy layer
threshold The SNR threshold above which reception is correct
sensitivity The strength (mW) at which a signal can be received
centerFrequency The frequency used by the phy layer
decodingCurrentDelta The additional amount of power it takes to decode a signal
myIndex The index of this deciders host (for debug output)
debug Use debug output?

Definition at line 11 of file Decider80211MultiChannel.cc.

                     :
  Decider80211Battery(phy, threshold, sensitivity,
            currentChannel, decodingCurrentDelta,
            myIndex, debug),
  currentChannel(currentChannel)
{
}


Member Function Documentation

void Decider80211MultiChannel::channelChanged ( int  newChannel  )  [virtual]

Called by phy layer to indicate that the channel this radio currently listens to has changed.

Sub-classing deciders which support multiple channels should override this method to handle the effects of channel changes on ongoing receptions.

Parameters:
newChannel The new channel the radio has changed to.

Reimplemented from Decider.

Definition at line 67 of file Decider80211MultiChannel.cc.

References Decider80211::centerFrequency, and BaseDecider::channelStateChanged().

                                                            {
  assert(1 <= currentChannel && currentChannel <= 14);
  currentChannel = newChannel;
  centerFrequency = CENTER_FREQUENCIES[currentChannel];
  channelStateChanged();
}

DeciderResult * Decider80211MultiChannel::checkIfSignalOk ( AirFrame *  frame  )  [protected, virtual]

Checks if the passed completed AirFrame was received correctly.

Returns the result as a DeciderResult. If the channel changed during transmission the AirFrame is considered broken.

Returns:
The result of the decider for the passed AirFrame.

Reimplemented from Decider80211.

Definition at line 49 of file Decider80211MultiChannel.cc.

References ConstMappingIterator::getValue(), and ConstMappingIterator::next().

                                                                        {
  DeciderResult* result = 0;

  if(frame->getChannel() != currentChannel) {
    ConstMappingIterator* bitrateIt
        = frame->getSignal().getBitrate()->createConstIterator();
    bitrateIt->next(); //iterate to payload bitrate indicator
    double payloadBitrate = bitrateIt->getValue();
    delete bitrateIt;
    deciderEV << "Channel changed during reception. packet is lost!\n";
    result = new DeciderResult80211(false, payloadBitrate, 0);
  } else {
    result = Decider80211Battery::checkIfSignalOk(frame);
  }

  return result;
}

void Decider80211MultiChannel::getChannelInfo ( simtime_t  start,
simtime_t  end,
AirFrameVector out 
) [protected, virtual]

Collects the AirFrame on the channel during the passed interval.

Filters all AirFrames not on the same channel as this deciders radio.

Parameters:
start The start of the interval to collect AirFrames from.
end The end of the interval to collect AirFrames from.
out The output vector in which to put the AirFrames.

Reimplemented from BaseDecider.

Definition at line 27 of file Decider80211MultiChannel.cc.

{
  Decider80211Battery::getChannelInfo(start, end, out);

  for(AirFrameVector::iterator it = out.begin();
    it != out.end(); ++it)
  {
    AirFrame* af = *it;
    if(af->getChannel() != currentChannel) {
      it = out.erase(it);
      --it;
    }
  }
}

simtime_t Decider80211MultiChannel::processNewSignal ( AirFrame *  frame  )  [protected, virtual]

Filters AirFrames on other channels than the current one.

See processNewSignal of Decider80211 for details.

Parameters:
frame The AirFrame to process.
Returns:
The time the AirFrame should be handled next by this decider.

Reimplemented from Decider80211.

Definition at line 42 of file Decider80211MultiChannel.cc.

References Decider::notAgain.

                                                                    {
  if(frame->getChannel() != currentChannel)
    return notAgain;

  return Decider80211Battery::processNewSignal(frame);
}


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