📄 asyncsnrdecider.cc
字号:
/* -*- mode:c++ -*- ********************************************************
* file: AsyncSnrDecider.cc
*
* author: Yupeng.hu
*
* copyright: (C) 2006 HUNAN Universtiy, ChangSha China
*
***************************************************************************
* part of: Async Simulation
* description: - Async Description
*
***************************************************************************
* changelog: $Revision$
* last modified: $Date: 2006-7-13 13:02 $
* by: $Author: Yupeng.hu $
***************************************************************************/
#include "AsyncSnrDecider.h"
#include <AirFrame_m.h>
#include <FWMath.h>
#define EV (ev.disabled()||!debug) ? (std::ostream&)ev : ev << logName() << "::AsyncSnrDecider: "
Define_Module(AsyncSnrDecider);
void AsyncSnrDecider::initialize(int stage)
{
BasicDecider::initialize(stage);
if(stage==0){
snrThresholdLevel=FWMath::dBm2mW(par("snrThresholdLevel"));
}
}
/**
Checks the received sduList (from the PhySDU header) if it contains an
snr level above the threshold
*/
bool AsyncSnrDecider::snrOverThreshold(SnrList &snrlist) const
{
//check the entries in the sduList if a level is lower than the
//acceptable minimum:
for(SnrList::const_iterator iter=snrlist.begin(); iter!=snrlist.end();iter++){
if(iter->snr<=snrThresholdLevel){
EV <<"Message got lost. MessageSnr: "<<iter->snr<<" Threshold: "<<snrThresholdLevel<<endl;
return false;
}
}
return true;
}
void AsyncSnrDecider::handleLowerMsg(AirFrame *af, SnrList &receivedList)
{
if(snrOverThreshold(receivedList)){
EV <<"Message handed on to Mac\n";
sendUp(af);
}
else{
delete af;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -