237 { |
237 { |
238 EnableAscii (os, NodeContainer::GetGlobal ()); |
238 EnableAscii (os, NodeContainer::GetGlobal ()); |
239 } |
239 } |
240 |
240 |
241 NetDeviceContainer |
241 NetDeviceContainer |
242 WifiHelper::Install (NodeContainer c) const |
242 WifiHelper::Install (Ptr<Node> node) const |
|
243 { |
|
244 return Install (NodeContainer (node)); |
|
245 } |
|
246 |
|
247 NetDeviceContainer |
|
248 WifiHelper::Install (Ptr<Node> node, Ptr<WifiChannel> channel) const |
|
249 { |
|
250 return NetDeviceContainer (InstallPriv (node, channel)); |
|
251 } |
|
252 |
|
253 NetDeviceContainer |
|
254 WifiHelper::Install (const NodeContainer &c) const |
243 { |
255 { |
244 Ptr<WifiChannel> channel = CreateObject<WifiChannel> (); |
256 Ptr<WifiChannel> channel = CreateObject<WifiChannel> (); |
245 channel->SetPropagationDelayModel (CreateObject<ConstantSpeedPropagationDelayModel> ()); |
257 channel->SetPropagationDelayModel (CreateObject<ConstantSpeedPropagationDelayModel> ()); |
246 Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> (); |
258 Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> (); |
247 log->SetReferenceModel (CreateObject<FriisPropagationLossModel> ()); |
259 log->SetReferenceModel (CreateObject<FriisPropagationLossModel> ()); |
248 channel->SetPropagationLossModel (log); |
260 channel->SetPropagationLossModel (log); |
|
261 |
249 return Install (c, channel); |
262 return Install (c, channel); |
250 } |
263 } |
251 NetDeviceContainer |
264 |
252 WifiHelper::Install (NodeContainer c, Ptr<WifiChannel> channel) const |
265 NetDeviceContainer |
253 { |
266 WifiHelper::Install (const NodeContainer &c, Ptr<WifiChannel> channel) const |
254 NetDeviceContainer devices; |
267 { |
|
268 NetDeviceContainer devs; |
|
269 |
255 for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++) |
270 for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++) |
256 { |
271 { |
257 Ptr<Node> node = *i; |
272 devs.Add (InstallPriv (*i, channel)); |
258 Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> (); |
273 } |
259 Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> (); |
274 |
260 Ptr<WifiMac> mac = m_mac.Create<WifiMac> (); |
275 return devs; |
261 Ptr<WifiPhy> phy = m_phy.Create<WifiPhy> (); |
276 } |
262 mac->SetAddress (Mac48Address::Allocate ()); |
277 |
263 device->SetMac (mac); |
278 Ptr<NetDevice> |
264 device->SetPhy (phy); |
279 WifiHelper::InstallPriv (Ptr<Node> node, Ptr<WifiChannel> channel) const |
265 device->SetRemoteStationManager (manager); |
280 { |
266 device->SetChannel (channel); |
281 Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> (); |
267 node->AddDevice (device); |
282 Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> (); |
268 devices.Add (device); |
283 Ptr<WifiMac> mac = m_mac.Create<WifiMac> (); |
269 NS_LOG_DEBUG ("node="<<node<<", mob="<<node->GetObject<MobilityModel> ()); |
284 Ptr<WifiPhy> phy = m_phy.Create<WifiPhy> (); |
270 } |
285 mac->SetAddress (Mac48Address::Allocate ()); |
271 return devices; |
286 device->SetMac (mac); |
|
287 device->SetPhy (phy); |
|
288 device->SetRemoteStationManager (manager); |
|
289 device->SetChannel (channel); |
|
290 node->AddDevice (device); |
|
291 NS_LOG_DEBUG ("node="<<node<<", mob="<<node->GetObject<MobilityModel> ()); |
|
292 |
|
293 return device; |
272 } |
294 } |
273 |
295 |
274 } // namespace ns3 |
296 } // namespace ns3 |