From d643cf8c1de6f92997bd450473fbbfb06855815c Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 8 Oct 2007 15:36:37 +0200 Subject: [PATCH] add WifiMode mandatory flag --- src/devices/wifi/wifi-mode.cc | 16 ++++++++++++++++ src/devices/wifi/wifi-mode.h | 13 +++++++++++++ src/devices/wifi/wifi-phy.cc | 8 ++++++++ 3 files changed, 37 insertions(+) diff --git a/src/devices/wifi/wifi-mode.cc b/src/devices/wifi/wifi-mode.cc index a84f8f019..f2141e31e 100644 --- a/src/devices/wifi/wifi-mode.cc +++ b/src/devices/wifi/wifi-mode.cc @@ -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); } diff --git a/src/devices/wifi/wifi-mode.h b/src/devices/wifi/wifi-mode.h index 7133f8412..200e9fb5f 100644 --- a/src/devices/wifi/wifi-mode.h +++ b/src/devices/wifi/wifi-mode.h @@ -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); diff --git a/src/devices/wifi/wifi-phy.cc b/src/devices/wifi/wifi-phy.cc index f04aae12c..015404a3c 100644 --- a/src/devices/wifi/wifi-phy.cc +++ b/src/devices/wifi/wifi-phy.cc @@ -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);