--- a/src/wifi/model/yans-wifi-channel.cc Fri May 06 13:21:20 2011 -0700
+++ b/src/wifi/model/yans-wifi-channel.cc Sat May 07 21:49:46 2011 +0200
@@ -3,7 +3,7 @@
* Copyright (c) 2006,2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
+ * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
@@ -36,7 +36,7 @@
NS_OBJECT_ENSURE_REGISTERED (YansWifiChannel);
-TypeId
+TypeId
YansWifiChannel::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::YansWifiChannel")
@@ -50,30 +50,31 @@
PointerValue (),
MakePointerAccessor (&YansWifiChannel::m_delay),
MakePointerChecker<PropagationDelayModel> ())
- ;
+ ;
return tid;
}
YansWifiChannel::YansWifiChannel ()
-{}
+{
+}
YansWifiChannel::~YansWifiChannel ()
{
NS_LOG_FUNCTION_NOARGS ();
m_phyList.clear ();
}
-void
+void
YansWifiChannel::SetPropagationLossModel (Ptr<PropagationLossModel> loss)
{
m_loss = loss;
}
-void
+void
YansWifiChannel::SetPropagationDelayModel (Ptr<PropagationDelayModel> delay)
{
m_delay = delay;
}
-void
+void
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
WifiMode wifiMode, WifiPreamble preamble) const
{
@@ -81,18 +82,20 @@
NS_ASSERT (senderMobility != 0);
uint32_t j = 0;
for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++, j++)
- {
+ {
if (sender != (*i))
{
// For now don't account for inter channel interference
- if ((*i)->GetChannelNumber() != sender->GetChannelNumber())
+ if ((*i)->GetChannelNumber () != sender->GetChannelNumber ())
+ {
continue;
-
+ }
+
Ptr<MobilityModel> receiverMobility = (*i)->GetMobility ()->GetObject<MobilityModel> ();
Time delay = m_delay->GetDelay (senderMobility, receiverMobility);
double rxPowerDbm = m_loss->CalcRxPower (txPowerDbm, senderMobility, receiverMobility);
- NS_LOG_DEBUG ("propagation: txPower="<<txPowerDbm<<"dbm, rxPower="<<rxPowerDbm<<"dbm, "<<
- "distance="<<senderMobility->GetDistanceFrom (receiverMobility)<<"m, delay="<<delay);
+ NS_LOG_DEBUG ("propagation: txPower=" << txPowerDbm << "dbm, rxPower=" << rxPowerDbm << "dbm, " <<
+ "distance=" << senderMobility->GetDistanceFrom (receiverMobility) << "m, delay=" << delay);
Ptr<Packet> copy = packet->Copy ();
Ptr<Object> dstNetDevice = m_phyList[j]->GetDevice ();
uint32_t dstNode;
@@ -105,7 +108,7 @@
dstNode = dstNetDevice->GetObject<NetDevice> ()->GetNode ()->GetId ();
}
Simulator::ScheduleWithContext (dstNode,
- delay, &YansWifiChannel::Receive, this,
+ delay, &YansWifiChannel::Receive, this,
j, copy, rxPowerDbm, wifiMode, preamble);
}
}
@@ -118,18 +121,18 @@
m_phyList[i]->StartReceivePacket (packet, rxPowerDbm, txMode, preamble);
}
-uint32_t
+uint32_t
YansWifiChannel::GetNDevices (void) const
{
return m_phyList.size ();
}
-Ptr<NetDevice>
+Ptr<NetDevice>
YansWifiChannel::GetDevice (uint32_t i) const
{
return m_phyList[i]->GetDevice ()->GetObject<NetDevice> ();
}
-void
+void
YansWifiChannel::Add (Ptr<YansWifiPhy> phy)
{
m_phyList.push_back (phy);