MiXiM  2.3
SNRThresholdDecider.h
00001 #ifndef SNRTHRESHOLDDECIDER_H_
00002 #define SNRTHRESHOLDDECIDER_H_
00003 
00004 #include "MiXiMDefs.h"
00005 #include "BaseDecider.h"
00006 
00036 class MIXIM_API SNRThresholdDecider : public BaseDecider
00037 {
00038 protected:
00040   double snrThreshold;
00041 
00043   double busyThreshold;
00044 
00045 protected:
00046 
00055   virtual bool checkIfAboveThreshold(Mapping* map, simtime_t_cref start, simtime_t_cref end) const;
00056 
00066   virtual DeciderResult* createResult(const airframe_ptr_t frame) const;
00067 
00072   virtual simtime_t canAnswerCSR(const CSRInfo& requestInfo) const;
00073 
00080   virtual void answerCSR(CSRInfo& requestInfo);
00081 
00087   bool isIdleRSSI(double rssi) const {
00088     return rssi <= busyThreshold;
00089   }
00090 
00091 public:
00092 
00106   SNRThresholdDecider( DeciderToPhyInterface* phy
00107                      , double                 sensitivity
00108                      , int                    myIndex = -1
00109                      , bool                   debug   = false)
00110     : BaseDecider(phy, sensitivity, myIndex, debug)
00111     , snrThreshold(0)
00112     , busyThreshold(sensitivity)
00113   {}
00114 
00123   virtual bool initFromMap(const ParameterMap& params);
00124 
00125   virtual ~SNRThresholdDecider() {};
00126 
00134   virtual ChannelState getChannelState() const;
00135 };
00136 
00137 #endif /* SNRTHRESHOLDDECIDER_H_ */