I am using the newly released INET 4.0 framework for OMNET++ and I would like to obtain the received signal strength value in a wireless host (of type AdhocHost). How may I do that?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
In INET
4.0.0 the packet received by a module contains several tags. Between others there is SignalPowerInd
tag. According to SignalTag.msg:
This indication specifies the average analog signal power that was detected during receiving the packet. It may be present on a packet from the phyiscal layer to the application.
This tag is present in packet processing by a wireless MAC layer, for example:
And packet received by application layer contains SignalPowerInd
too:
One can obtain the value of
SignalPowerInd
from received radio packet in any layer using standard API. For example, to obtain it in UdpBasicApp
one should add in UdpBasicApp.cc
:
#include "inet/physicallayer/common/packetlevel/SignalTag_m.h"
// ...
void UdpBasicApp::socketDataArrived(UdpSocket *socket, Packet *packet) {
if (packet->findTag<SignalPowerInd>() != nullptr) {
auto signalPowerInd = packet->getTag<SignalPowerInd>();
auto rxPower = signalPowerInd->getPower().get();
EV_INFO << "RX power= " << rxPower << "W" << endl;
}
// process incoming packet
processPacket(packet);
}