--- a/RELEASE_NOTES Fri May 13 09:36:53 2016 +0200
+++ b/RELEASE_NOTES Fri May 13 09:40:59 2016 +0200
@@ -40,6 +40,7 @@
- Bug 2378 - A-MPDU variables are not correctly reset in YansWifiPhy when a PLCP preamble/header failed
- Bug 2383 - IPv4 header for reassembled packets reports a wrong payload size
- Bug 2392 - SYN segment advertised window should not be scaled
+- Bug 2396 - move utility functions to WifiPhy
Known issues
------------
--- a/src/wifi/model/wifi-phy.cc Fri May 13 09:36:53 2016 +0200
+++ b/src/wifi/model/wifi-phy.cc Fri May 13 09:40:59 2016 +0200
@@ -1595,6 +1595,32 @@
return true;
}
+double
+WifiPhy::DbToRatio (double dB) const
+{
+ double ratio = std::pow (10.0, dB / 10.0);
+ return ratio;
+}
+
+double
+WifiPhy::DbmToW (double dBm) const
+{
+ double mW = std::pow (10.0, dBm / 10.0);
+ return mW / 1000.0;
+}
+
+double
+WifiPhy::WToDbm (double w) const
+{
+ return 10.0 * std::log10 (w * 1000.0);
+}
+
+double
+WifiPhy::RatioToDb (double ratio) const
+{
+ return 10.0 * std::log10 (ratio);
+}
+
std::ostream& operator<< (std::ostream& os, enum WifiPhy::State state)
{
switch (state)
--- a/src/wifi/model/wifi-phy.h Fri May 13 09:36:53 2016 +0200
+++ b/src/wifi/model/wifi-phy.h Fri May 13 09:40:59 2016 +0200
@@ -1297,6 +1297,38 @@
* \return a vector containing the supported channel widths, values in MHz
*/
virtual std::vector<uint32_t> GetSupportedChannelWidthSet (void) const = 0;
+ /**
+ * Convert from dBm to Watts.
+ *
+ * \param dbm the power in dBm
+ *
+ * \return the equivalent Watts for the given dBm
+ */
+ double DbmToW (double dbm) const;
+ /**
+ * Convert from dB to ratio.
+ *
+ * \param db
+ *
+ * \return ratio
+ */
+ double DbToRatio (double db) const;
+ /**
+ * Convert from Watts to dBm.
+ *
+ * \param w the power in Watts
+ *
+ * \return the equivalent dBm for the given Watts
+ */
+ double WToDbm (double w) const;
+ /**
+ * Convert from ratio to dB.
+ *
+ * \param ratio
+ *
+ * \return dB
+ */
+ double RatioToDb (double ratio) const;
private:
/**
--- a/src/wifi/model/yans-wifi-phy.cc Fri May 13 09:36:53 2016 +0200
+++ b/src/wifi/model/yans-wifi-phy.cc Fri May 13 09:40:59 2016 +0200
@@ -1145,32 +1145,6 @@
}
double
-YansWifiPhy::DbToRatio (double dB) const
-{
- double ratio = std::pow (10.0, dB / 10.0);
- return ratio;
-}
-
-double
-YansWifiPhy::DbmToW (double dBm) const
-{
- double mW = std::pow (10.0, dBm / 10.0);
- return mW / 1000.0;
-}
-
-double
-YansWifiPhy::WToDbm (double w) const
-{
- return 10.0 * std::log10 (w * 1000.0);
-}
-
-double
-YansWifiPhy::RatioToDb (double ratio) const
-{
- return 10.0 * std::log10 (ratio);
-}
-
-double
YansWifiPhy::GetEdThresholdW (void) const
{
return m_edThresholdW;
--- a/src/wifi/model/yans-wifi-phy.h Fri May 13 09:36:53 2016 +0200
+++ b/src/wifi/model/yans-wifi-phy.h Fri May 13 09:40:59 2016 +0200
@@ -476,38 +476,6 @@
*/
double GetEdThresholdW (void) const;
/**
- * Convert from dBm to Watts.
- *
- * \param dbm the power in dBm
- *
- * \return the equivalent Watts for the given dBm
- */
- double DbmToW (double dbm) const;
- /**
- * Convert from dB to ratio.
- *
- * \param db
- *
- * \return ratio
- */
- double DbToRatio (double db) const;
- /**
- * Convert from Watts to dBm.
- *
- * \param w the power in Watts
- *
- * \return the equivalent dBm for the given Watts
- */
- double WToDbm (double w) const;
- /**
- * Convert from ratio to dB.
- *
- * \param ratio
- *
- * \return dB
- */
- double RatioToDb (double ratio) const;
- /**
* Get the power of the given power level in dBm.
* In YansWifiPhy implementation, the power levels are equally spaced (in dBm).
*