add WifiMode mandatory flag

This commit is contained in:
Mathieu Lacage
2007-10-08 15:36:37 +02:00
parent 0873562023
commit d643cf8c1d
3 changed files with 37 additions and 0 deletions

View File

@@ -33,12 +33,24 @@ WifiMode::IsModulationQam (void) const
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->modulation == WifiMode::QAM;
}
enum WifiMode::ModulationType
WifiMode::GetModulationType (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->modulation;
}
uint8_t
WifiMode::GetConstellationSize (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->constellationSize;
}
bool
WifiMode::IsMandatory (void) const
{
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->isMandatory;
}
uint32_t
WifiMode::GetUid (void) const
{
@@ -55,6 +67,7 @@ WifiModeFactory::WifiModeFactory ()
WifiMode
WifiModeFactory::CreateBpsk (std::string uniqueName,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
uint32_t phyRate)
@@ -67,10 +80,12 @@ WifiModeFactory::CreateBpsk (std::string uniqueName,
item->phyRate = phyRate;
item->modulation = WifiMode::BPSK;
item->constellationSize = 2;
item->isMandatory = isMandatory;
return WifiMode (uid);
}
WifiMode
WifiModeFactory::CreateQam (std::string uniqueName,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
uint32_t phyRate,
@@ -84,6 +99,7 @@ WifiModeFactory::CreateQam (std::string uniqueName,
item->phyRate = phyRate;
item->modulation = WifiMode::QAM;
item->constellationSize = constellationSize;
item->isMandatory = isMandatory;
return WifiMode (uid);
}

View File

@@ -40,11 +40,21 @@ class WifiMode
* otherwise.
*/
bool IsModulationQam (void) const;
/**
* \returns the type of modulation used by this mode.
*/
enum ModulationType GetModulationType (void) const;
/**
* \returns the size of the modulation constellation.
*/
uint8_t GetConstellationSize (void) const;
/**
* \returns true if this mode is a mandatory mode, false
* otherwise.
*/
bool IsMandatory (void) const;
/**
* \returns the uid associated to this wireless mode.
*
@@ -64,10 +74,12 @@ class WifiModeFactory
{
public:
static WifiMode CreateBpsk (std::string uniqueName,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
uint32_t phyRate);
static WifiMode CreateQam (std::string uniqueName,
bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
uint32_t phyRate,
@@ -84,6 +96,7 @@ private:
uint32_t phyRate;
enum WifiMode::ModulationType modulation;
uint8_t constellationSize;
bool isMandatory;
};
uint32_t AllocateUid (std::string uniqueName);

View File

@@ -63,20 +63,28 @@ namespace ns3 {
// Define all the WifiMode needed for 802.11a
static WifiMode g_6mba = WifiModeFactory::CreateBpsk ("wifia-6mbs",
true,
20000000, 6000000 * 1 / 2, 6000000);
static WifiMode g_9mba = WifiModeFactory::CreateBpsk ("wifia-9mbs",
false,
20000000, 9000000 * 3 / 4, 9000000);
static WifiMode g_12mba = WifiModeFactory::CreateBpsk ("wifia-12mbs",
true,
20000000, 12000000 * 1 / 2, 12000000);
static WifiMode g_18mba = WifiModeFactory::CreateBpsk ("wifia-18mbs",
false,
20000000, 18000000 * 3 / 4, 18000000);
static WifiMode g_24mba = WifiModeFactory::CreateBpsk ("wifia-24mbs",
true,
20000000, 24000000 * 1 / 2, 24000000);
static WifiMode g_36mba = WifiModeFactory::CreateBpsk ("wifia-36mbs",
false,
20000000, 36000000 * 3 / 4, 36000000);
static WifiMode g_48mba = WifiModeFactory::CreateBpsk ("wifia-48mbs",
false,
20000000, 48000000 * 2 / 3, 48000000);
static WifiMode g_54mba = WifiModeFactory::CreateBpsk ("wifia-54mbs",
false,
20000000, 54000000 * 3 / 4, 54000000);