SNRThresholdDecider.h

00001 #ifndef SNRTHRESHOLDDECIDER_H_
00002 #define SNRTHRESHOLDDECIDER_H_
00003 
00004 #include <BaseDecider.h>
00005 
00035 class SNRThresholdDecider : public BaseDecider
00036 {
00037 protected:
00039   double snrThreshold;
00040 
00042   double busyThreshold;
00043 
00044 protected:
00045 
00054   virtual bool checkIfAboveThreshold(Mapping* map, simtime_t start, simtime_t end);
00055 
00067   virtual simtime_t processNewSignal(AirFrame* frame);
00068 
00078   virtual simtime_t processSignalEnd(AirFrame* frame);
00079 
00084   virtual simtime_t canAnswerCSR(const CSRInfo& requestInfo);
00085 
00092   virtual void answerCSR(CSRInfo& requestInfo);
00093 
00099   bool isIdleRSSI(double rssi) const {
00100     return rssi <= busyThreshold;
00101   }
00102 
00103 public:
00104 
00118   SNRThresholdDecider(DeciderToPhyInterface* phy,
00119         double snrThreshold,
00120         double sensitivity,
00121         double busyThreshold,
00122         int myIndex = -1,
00123         bool debug = false):
00124     BaseDecider(phy, sensitivity, myIndex, debug),
00125     snrThreshold(snrThreshold),
00126     busyThreshold(busyThreshold)
00127   {}
00128 
00129   virtual ~SNRThresholdDecider() {};
00130 
00138   virtual ChannelState getChannelState();
00139 };
00140 
00141 #endif /* SNRTHRESHOLDDECIDER_H_ */