OLD | NEW |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2006,2007 INRIA | 3 * Copyright (c) 2006,2007 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as· | 6 * it under the terms of the GNU General Public License version 2 as· |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 m_delay = delay; | 70 m_delay = delay; |
71 } | 71 } |
72 | 72 |
73 void· | 73 void· |
74 YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double
txPowerDbm, | 74 YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double
txPowerDbm, |
75 WifiMode wifiMode, WifiPreamble preamble) const | 75 WifiMode wifiMode, WifiPreamble preamble) const |
76 { | 76 { |
77 Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<Mobility
Model> (); | 77 Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<Mobility
Model> (); |
78 NS_ASSERT (senderMobility != 0); | 78 NS_ASSERT (senderMobility != 0); |
79 uint32_t j = 0; | 79 uint32_t j = 0; |
80 for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i+
+) | 80 for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i+
+, j++) |
81 { | 81 { |
82 if (sender != (*i)) | 82 if (sender != (*i)) |
83 { | 83 { |
| 84 // For now don't account for inter channel interference |
| 85 if ((*i)->GetChannelNumber() != sender->GetChannelNumber()) |
| 86 continue; |
| 87 ·········· |
84 Ptr<MobilityModel> receiverMobility = (*i)->GetMobility ()->GetObject<
MobilityModel> (); | 88 Ptr<MobilityModel> receiverMobility = (*i)->GetMobility ()->GetObject<
MobilityModel> (); |
85 Time delay = m_delay->GetDelay (senderMobility, receiverMobility); | 89 Time delay = m_delay->GetDelay (senderMobility, receiverMobility); |
86 double rxPowerDbm = m_loss->CalcRxPower (txPowerDbm, senderMobility, r
eceiverMobility); | 90 double rxPowerDbm = m_loss->CalcRxPower (txPowerDbm, senderMobility, r
eceiverMobility); |
87 NS_LOG_DEBUG ("propagation: txPower="<<txPowerDbm<<"dbm, rxPower="<<rx
PowerDbm<<"dbm, "<< | 91 NS_LOG_DEBUG ("propagation: txPower="<<txPowerDbm<<"dbm, rxPower="<<rx
PowerDbm<<"dbm, "<< |
88 "distance="<<senderMobility->GetDistanceFrom (receiverMo
bility)<<"m, delay="<<delay); | 92 "distance="<<senderMobility->GetDistanceFrom (receiverMo
bility)<<"m, delay="<<delay); |
89 Ptr<Packet> copy = packet->Copy (); | 93 Ptr<Packet> copy = packet->Copy (); |
90 Simulator::Schedule (delay, &YansWifiChannel::Receive, this,· | 94 Simulator::Schedule (delay, &YansWifiChannel::Receive, this,· |
91 j, copy, rxPowerDbm, wifiMode, preamble); | 95 j, copy, rxPowerDbm, wifiMode, preamble); |
92 } | 96 } |
93 j++; | |
94 } | 97 } |
95 } | 98 } |
96 | 99 |
97 void | 100 void |
98 YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, double rxPowerDbm, | 101 YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, double rxPowerDbm, |
99 WifiMode txMode, WifiPreamble preamble) const | 102 WifiMode txMode, WifiPreamble preamble) const |
100 { | 103 { |
101 m_phyList[i]->StartReceivePacket (packet, rxPowerDbm, txMode, preamble); | 104 m_phyList[i]->StartReceivePacket (packet, rxPowerDbm, txMode, preamble); |
102 } | 105 } |
103 | 106 |
104 uint32_t· | 107 uint32_t· |
105 YansWifiChannel::GetNDevices (void) const | 108 YansWifiChannel::GetNDevices (void) const |
106 { | 109 { |
107 return m_phyList.size (); | 110 return m_phyList.size (); |
108 } | 111 } |
109 Ptr<NetDevice>· | 112 Ptr<NetDevice>· |
110 YansWifiChannel::GetDevice (uint32_t i) const | 113 YansWifiChannel::GetDevice (uint32_t i) const |
111 { | 114 { |
112 return m_phyList[i]->GetDevice ()->GetObject<NetDevice> (); | 115 return m_phyList[i]->GetDevice ()->GetObject<NetDevice> (); |
113 } | 116 } |
114 | 117 |
115 void· | 118 void· |
116 YansWifiChannel::Add (Ptr<YansWifiPhy> phy) | 119 YansWifiChannel::Add (Ptr<YansWifiPhy> phy) |
117 { | 120 { |
118 m_phyList.push_back (phy); | 121 m_phyList.push_back (phy); |
119 } | 122 } |
120 | 123 |
121 } // namespace ns3 | 124 } // namespace ns3 |
OLD | NEW |