--- a/src/wifi/model/wifi-tx-vector.cc Fri Dec 19 16:22:49 2014 -0800
+++ b/src/wifi/model/wifi-tx-vector.cc Fri Dec 19 18:28:40 2014 -0800
@@ -20,10 +20,18 @@
*/
#include "ns3/wifi-tx-vector.h"
+#include "ns3/fatal-error.h"
namespace ns3 {
WifiTxVector::WifiTxVector ()
+ : m_retries (0),
+ m_shortGuardInterval (false),
+ m_nss (1),
+ m_ness (0),
+ m_stbc (false),
+ m_modeInitialized (false),
+ m_txPowerLevelInitialized (false)
{
}
@@ -35,18 +43,28 @@
m_shortGuardInterval(shortGuardInterval),
m_nss(nss),
m_ness(ness),
- m_stbc(stbc)
+ m_stbc(stbc),
+ m_modeInitialized (true),
+ m_txPowerLevelInitialized (true)
{
}
WifiMode
WifiTxVector::GetMode (void) const
{
+ if (!m_modeInitialized)
+ {
+ NS_FATAL_ERROR ("WifiTxVector mode must be set before using");
+ }
return m_mode;
}
uint8_t
WifiTxVector::GetTxPowerLevel (void) const
{
+ if (!m_txPowerLevelInitialized)
+ {
+ NS_FATAL_ERROR ("WifiTxVector txPowerLevel must be set before using");
+ }
return m_txPowerLevel;
}
uint8_t
@@ -79,11 +97,13 @@
WifiTxVector::SetMode (WifiMode mode)
{
m_mode=mode;
+ m_modeInitialized = true;
}
void
WifiTxVector::SetTxPowerLevel (uint8_t powerlevel)
{
m_txPowerLevel=powerlevel;
+ m_txPowerLevelInitialized = true;
}
void
WifiTxVector::SetRetries (uint8_t retries)
--- a/src/wifi/model/wifi-tx-vector.h Fri Dec 19 16:22:49 2014 -0800
+++ b/src/wifi/model/wifi-tx-vector.h Fri Dec 19 18:28:40 2014 -0800
@@ -35,6 +35,20 @@
* and also 15.4.4.2 "PMD_SAP peer-to-peer service primitive
* parameters".
*
+ * If this class is constructed with the constructor that takes no
+ * arguments, then the client must explicitly set the mode and
+ * transmit power level parameters before using them. Default
+ * member initializers are provided for the other parameters, to
+ * conform to a non-MIMO/long guard configuration, although these
+ * may also be explicitly set after object construction.
+ *
+ * When used in a infrastructure context, WifiTxVector values should be
+ * drawn from WifiRemoteStationManager parameters since rate adaptation
+ * is responsible for picking the mode, number of streams, etc., but in
+ * the case in which there is no such manager (e.g. mesh), the client
+ * still needs to initialize at least the mode and transmit power level
+ * appropriately.
+ *
* \note the above reference is valid for the DSSS PHY only (clause
* 15). TXVECTOR is defined also for the other PHYs, however they
* don't include the TXPWRLVL explicitly in the TXVECTOR. This is
@@ -144,10 +158,13 @@
to PMD_TXPWRLVL.request */
uint8_t m_retries; /**< The DATA_RETRIES/RTS_RETRIES parameter
for Click radiotap information */
- bool m_shortGuardInterval; //true if short GI is going to be used
- uint8_t m_nss; //number of streams
- uint8_t m_ness; //number of streams in beamforming
- bool m_stbc; //STBC used or not
+ bool m_shortGuardInterval; /**< true if short GI is going to be used */
+ uint8_t m_nss; /**< number of streams */
+ uint8_t m_ness; /**< number of streams in beamforming */
+ bool m_stbc; /**< STBC used or not */
+
+ bool m_modeInitialized; //*< Internal initialization flag */
+ bool m_txPowerLevelInitialized; //*< Internal initialization flag */
};