--- a/src/devices/wifi/wifi-mode.cc Mon Oct 08 14:43:53 2007 +0200
+++ b/src/devices/wifi/wifi-mode.cc Mon Oct 08 15:36:37 2007 +0200
@@ -33,12 +33,24 @@
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 @@
WifiMode
WifiModeFactory::CreateBpsk (std::string uniqueName,
+ bool isMandatory,
uint32_t bandwidth,
uint32_t dataRate,
uint32_t phyRate)
@@ -67,10 +80,12 @@
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 @@
item->phyRate = phyRate;
item->modulation = WifiMode::QAM;
item->constellationSize = constellationSize;
+ item->isMandatory = isMandatory;
return WifiMode (uid);
}
--- a/src/devices/wifi/wifi-mode.h Mon Oct 08 14:43:53 2007 +0200
+++ b/src/devices/wifi/wifi-mode.h Mon Oct 08 15:36:37 2007 +0200
@@ -41,11 +41,21 @@
*/
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.
*
* Each specific wireless mode should have a different uid.
@@ -64,10 +74,12 @@
{
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 @@
uint32_t phyRate;
enum WifiMode::ModulationType modulation;
uint8_t constellationSize;
+ bool isMandatory;
};
uint32_t AllocateUid (std::string uniqueName);
--- a/src/devices/wifi/wifi-phy.cc Mon Oct 08 14:43:53 2007 +0200
+++ b/src/devices/wifi/wifi-phy.cc Mon Oct 08 15:36:37 2007 +0200
@@ -63,20 +63,28 @@
// 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);