LEFT | RIGHT |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 NotifyRxEnd (packet); | 786 NotifyRxEnd (packet); |
787 uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () /
500000; | 787 uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () /
500000; |
788 bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ()); | 788 bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ()); |
789 double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30; | 789 double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30; |
790 double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNo
iseFigure () + 30; | 790 double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNo
iseFigure () + 30; |
791 uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE; | 791 uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE; |
792 RadiotapHeader radiotaphdr; | 792 RadiotapHeader radiotaphdr; |
793 radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());······· | 793 radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());······· |
794 Ptr<Packet> p = packet->Copy (); | 794 Ptr<Packet> p = packet->Copy (); |
795 p->AddHeader (radiotaphdr); | 795 p->AddHeader (radiotaphdr); |
796 p->RemoveHeader (radiotaphdr); | |
797 radiotaphdr.SetFrameFlags (frameFlags); | 796 radiotaphdr.SetFrameFlags (frameFlags); |
798 radiotaphdr.SetRate (dataRate500KbpsUnits); | 797 radiotaphdr.SetRate (dataRate500KbpsUnits); |
799 if (GetChannelFrequencyMhz () < 2500) | 798 if (GetChannelFrequencyMhz () < 2500) |
800 { | 799 { |
801 radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), | 800 radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), |
802 RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL
_FLAG_CCK); | 801 RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL
_FLAG_CCK); |
803 } | 802 } |
804 else | 803 else |
805 { | 804 { |
806 radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), | 805 radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), |
807 RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL
_FLAG_OFDM); | 806 RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL
_FLAG_OFDM); |
808 }··· | 807 }··· |
809 radiotaphdr.SetAntennaSignalPower (signalDbm); | 808 radiotaphdr.SetAntennaSignalPower (signalDbm); |
810 radiotaphdr.SetAntennaNoisePower (noiseDbm); | 809 radiotaphdr.SetAntennaNoisePower (noiseDbm); |
811 NotifyMonitorSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNu
mber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm); | 810 NotifyMonitorSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNu
mber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm); |
812 m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (),
event->GetPreambleType (), radiotaphdr); | 811 m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (),
event->GetPreambleType (), radiotaphdr); |
813 } | 812 } |
814 else | 813 else |
815 { | 814 { |
816 /* failure. */ | 815 /* failure. */ |
817 NotifyRxDrop (packet); | 816 NotifyRxDrop (packet); |
818 m_state->SwitchFromRxEndError (packet, snrPer.snr); | 817 m_state->SwitchFromRxEndError (packet, snrPer.snr); |
819 } | 818 } |
820 } | 819 } |
821 } // namespace ns3 | 820 } // namespace ns3 |
LEFT | RIGHT |