A simple Decider implementation which only checks for a received signal if the receiving power is above a certain value. More...
#include <ThresholdDecider.h>
Inherits Decider.
Public Member Functions | |
ThresholdDecider (DeciderToPhyInterface *phy, int myIndex, double threshold) | |
virtual simtime_t | processSignal (AirFrame *frame) |
this method is called by the BasePhylayer whenever it gets a AirFrame (from another phy or self scheduled). | |
virtual ChannelState | getChannelState () |
A function that returns information about the channel state. | |
virtual simtime_t | handleChannelSenseRequest (ChannelSenseRequest *) |
This function is called by the PhyLayer to hand over a ChannelSenseRequest. | |
Protected Types | |
enum | { FIRST, HEADER_OVER, SIGNAL_OVER } |
Protected Member Functions | |
simtime_t | handleNewSignal (Signal *s) |
handles Signals passed the first time. | |
simtime_t | handleHeaderOver (std::map< Signal *, int >::iterator &it) |
handles the Signal when passed after after end of the header. | |
simtime_t | handleSignalOver (std::map< Signal *, int >::iterator &it, AirFrame *frame) |
handles the signal when passed at the end of the signal. | |
void | log (std::string msg) |
double | toDecibel (double v) |
template<class T > | |
std::string | toString (T v, unsigned int length) |
std::string | toString (simtime_t v, unsigned int length) |
void | printMapping (ConstMapping *m) |
Quick and ugly printing of a two dimensional mapping. | |
Protected Attributes | |
int | myIndex |
double | threshold |
std::map< Signal *, int > | currentSignals |
stores the currently receiving signals together with their current state. |
A simple Decider implementation which only checks for a received signal if the receiving power is above a certain value.
Note: This implementation is only meant to be as a quick and ugly Decider to demonstrate (and print) how the AnalogueModels affect the signal. You should not take it as template for a real Decider!
Definition at line 24 of file ThresholdDecider.h.
virtual ChannelState ThresholdDecider::getChannelState | ( | ) | [inline, virtual] |
A function that returns information about the channel state.
It is an alternative for the MACLayer in order to obtain information immediately (in contrast to sending a ChannelSenseRequest, i.e. sending a cMessage over the OMNeT-control-channel)
Reimplemented from Decider.
Definition at line 291 of file ThresholdDecider.h.
{ return ChannelState(false, 0); }
virtual simtime_t ThresholdDecider::handleChannelSenseRequest | ( | ChannelSenseRequest * | request | ) | [inline, virtual] |
This function is called by the PhyLayer to hand over a ChannelSenseRequest.
The MACLayer is able to send a ChannelSenseRequest to the PhyLayer that calls this function with it and is returned a time point when to re-call this function with the specific ChannelSenseRequest.
The Decider puts the result (ChannelState) to the ChannelSenseRequest and "answers" by calling the "sendControlMsg"-function on the DeciderToPhyInterface, i.e. telling the PhyLayer to send it back.
Reimplemented from Decider.
Definition at line 294 of file ThresholdDecider.h.
{
return -1;
}