src/devices/wifi/ideal-mac-stations.cc
changeset 1964 041240a915f8
parent 1935 c7ac48654295
child 2162 4bf1541c02cf
equal deleted inserted replaced
1963:007214146da7 1964:041240a915f8
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    17  *
    17  *
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    19  */
    19  */
    20 #include "ideal-mac-stations.h"
    20 #include "ideal-mac-stations.h"
    21 #include "wifi-phy.h"
    21 #include "ns3/assert.h"
    22 #include <math.h>
    22 #include <math.h>
    23 
    23 
    24 #define noIDEAL_DEBUG 1
    24 #define noIDEAL_DEBUG 1
    25 
    25 
    26 #ifdef IDEAL_DEBUG
    26 #ifdef IDEAL_DEBUG
    59   NS_ASSERT (false);
    59   NS_ASSERT (false);
    60   return 0.0;
    60   return 0.0;
    61 }
    61 }
    62 
    62 
    63 void 
    63 void 
    64 IdealMacStations::InitializeThresholds (const WifiPhy *phy, double ber)
    64 IdealMacStations::AddModeSnrThreshold (WifiMode mode, double snr)
    65 {
    65 {
    66   uint8_t nModes = phy->GetNModes ();
    66   m_thresholds.push_back (std::make_pair (snr,mode));
    67   for (uint8_t i = 0; i < nModes; i++) 
       
    68     {
       
    69       WifiMode mode = phy->GetMode (i);
       
    70       double snr = phy->CalculateSnr (mode, ber);
       
    71       m_thresholds.push_back (std::make_pair (snr,mode));
       
    72     }
       
    73 }
    67 }
    74 
    68 
    75 IdealMacStation::IdealMacStation (IdealMacStations *stations)
    69 IdealMacStation::IdealMacStation (IdealMacStations *stations)
    76   : m_stations (stations)
    70   : m_stations (stations)
    77 {}
    71 {}