|
|
| 88 |
WifiMode::GetUniqueName (void) const |
88 |
WifiMode::GetUniqueName (void) const |
| 89 |
{ |
89 |
{ |
| 90 |
// needed for ostream printing of the invalid mode |
90 |
// needed for ostream printing of the invalid mode |
| 91 |
if (m_uid == 0) |
|
|
| 92 |
{ |
| 93 |
return "Invalid-WifiMode"; |
| 94 |
} |
| 95 |
|
| 96 |
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); |
91 |
struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid); |
| 97 |
return item->uniqueUid; |
92 |
return item->uniqueUid; |
| 98 |
} |
93 |
} |
|
|
| 220 |
bool |
215 |
bool |
| 221 |
WifiModeFactory::Search (std::string name, WifiMode *mode) |
216 |
WifiModeFactory::Search (std::string name, WifiMode *mode) |
| 222 |
{ |
217 |
{ |
| 223 |
uint32_t j = 1; |
218 |
uint32_t j = 0; |
| 224 |
for (WifiModeItemList::const_iterator i = m_itemList.begin (); |
219 |
for (WifiModeItemList::const_iterator i = m_itemList.begin (); |
| 225 |
i != m_itemList.end (); i++) |
220 |
i != m_itemList.end (); i++) |
| 226 |
{ |
221 |
{ |
|
|
| 238 |
uint32_t |
233 |
uint32_t |
| 239 |
WifiModeFactory::AllocateUid (std::string uniqueUid) |
234 |
WifiModeFactory::AllocateUid (std::string uniqueUid) |
| 240 |
{ |
235 |
{ |
| 241 |
uint32_t j = 1; |
236 |
uint32_t j = 0; |
| 242 |
for (WifiModeItemList::const_iterator i = m_itemList.begin (); |
237 |
for (WifiModeItemList::const_iterator i = m_itemList.begin (); |
| 243 |
i != m_itemList.end (); i++) |
238 |
i != m_itemList.end (); i++) |
| 244 |
{ |
239 |
{ |
|
|
| 248 |
} |
243 |
} |
| 249 |
j++; |
244 |
j++; |
| 250 |
} |
245 |
} |
|
|
246 |
uint32_t uid = m_itemList.size (); |
| 251 |
m_itemList.push_back (WifiModeItem ()); |
247 |
m_itemList.push_back (WifiModeItem ()); |
| 252 |
uint32_t uid = m_itemList.size (); |
|
|
| 253 |
return uid; |
248 |
return uid; |
| 254 |
} |
249 |
} |
| 255 |
|
250 |
|
| 256 |
struct WifiModeFactory::WifiModeItem * |
251 |
struct WifiModeFactory::WifiModeItem * |
| 257 |
WifiModeFactory::Get (uint32_t uid) |
252 |
WifiModeFactory::Get (uint32_t uid) |
| 258 |
{ |
253 |
{ |
| 259 |
NS_ASSERT (uid > 0 && uid <= m_itemList.size ()); |
254 |
NS_ASSERT (uid < m_itemList.size ()); |
| 260 |
return &m_itemList[uid - 1]; |
255 |
return &m_itemList[uid]; |
| 261 |
} |
256 |
} |
| 262 |
|
257 |
|
| 263 |
WifiModeFactory * |
258 |
WifiModeFactory * |
|
|
| 267 |
static WifiModeFactory factory; |
262 |
static WifiModeFactory factory; |
| 268 |
if (isFirstTime) |
263 |
if (isFirstTime) |
| 269 |
{ |
264 |
{ |
| 270 |
factory.AllocateUid ("Invalid-WifiMode"); |
265 |
uint32_t uid = factory.AllocateUid ("Invalid-WifiMode"); |
|
|
266 |
WifiModeItem *item = factory.Get (uid); |
| 267 |
item->uniqueUid = "Invalid-WifiMode"; |
| 268 |
item->bandwidth = 0; |
| 269 |
item->dataRate = 0; |
| 270 |
item->phyRate = 0; |
| 271 |
item->modulation = WifiMode::UNKNOWN; |
| 272 |
item->constellationSize = 0; |
| 273 |
item->isMandatory = false; |
| 274 |
item->standard = WIFI_PHY_UNKNOWN; |
| 271 |
isFirstTime = false; |
275 |
isFirstTime = false; |
| 272 |
} |
276 |
} |
| 273 |
return &factory; |
277 |
return &factory; |