equal
deleted
inserted
replaced
31 #include "ns3/log.h" |
31 #include "ns3/log.h" |
32 #include "ns3/double.h" |
32 #include "ns3/double.h" |
33 #include "ns3/uinteger.h" |
33 #include "ns3/uinteger.h" |
34 #include "ns3/enum.h" |
34 #include "ns3/enum.h" |
35 #include "ns3/pointer.h" |
35 #include "ns3/pointer.h" |
|
36 #include "ns3/net-device.h" |
36 #include <math.h> |
37 #include <math.h> |
37 |
38 |
38 NS_LOG_COMPONENT_DEFINE ("YansWifiPhy"); |
39 NS_LOG_COMPONENT_DEFINE ("YansWifiPhy"); |
39 |
40 |
40 namespace ns3 { |
41 namespace ns3 { |
128 YansWifiPhy::DoDispose (void) |
129 YansWifiPhy::DoDispose (void) |
129 { |
130 { |
130 NS_LOG_FUNCTION (this); |
131 NS_LOG_FUNCTION (this); |
131 m_channel = 0; |
132 m_channel = 0; |
132 m_modes.clear (); |
133 m_modes.clear (); |
|
134 m_device = 0; |
133 } |
135 } |
134 |
136 |
135 void |
137 void |
136 YansWifiPhy::SetStandard (enum WifiPhyStandard standard) |
138 YansWifiPhy::SetStandard (enum WifiPhyStandard standard) |
137 { |
139 { |
202 void |
204 void |
203 YansWifiPhy::SetErrorRateModel (Ptr<ErrorRateModel> rate) |
205 YansWifiPhy::SetErrorRateModel (Ptr<ErrorRateModel> rate) |
204 { |
206 { |
205 m_interference.SetErrorRateModel (rate); |
207 m_interference.SetErrorRateModel (rate); |
206 } |
208 } |
|
209 void |
|
210 YansWifiPhy::SetDevice (Ptr<Object> device) |
|
211 { |
|
212 m_device = device; |
|
213 } |
|
214 void |
|
215 YansWifiPhy::SetMobility (Ptr<Object> mobility) |
|
216 { |
|
217 m_mobility = mobility; |
|
218 } |
|
219 |
207 double |
220 double |
208 YansWifiPhy::GetRxNoise (void) const |
221 YansWifiPhy::GetRxNoise (void) const |
209 { |
222 { |
210 return RatioToDb (m_interference.GetNoiseFloorW ()); |
223 return RatioToDb (m_interference.GetNoiseFloorW ()); |
211 } |
224 } |
245 Ptr<ErrorRateModel> |
258 Ptr<ErrorRateModel> |
246 YansWifiPhy::GetErrorRateModel (void) const |
259 YansWifiPhy::GetErrorRateModel (void) const |
247 { |
260 { |
248 return m_interference.GetErrorRateModel (); |
261 return m_interference.GetErrorRateModel (); |
249 } |
262 } |
|
263 Ptr<Object> |
|
264 YansWifiPhy::GetDevice (void) const |
|
265 { |
|
266 return m_device; |
|
267 } |
|
268 Ptr<Object> |
|
269 YansWifiPhy::GetMobility (void) |
|
270 { |
|
271 return m_mobility; |
|
272 } |
250 |
273 |
251 double |
274 double |
252 YansWifiPhy::CalculateSnr (WifiMode txMode, double ber) const |
275 YansWifiPhy::CalculateSnr (WifiMode txMode, double ber) const |
253 { |
276 { |
254 return m_interference.GetErrorRateModel ()->CalculateSnr (txMode, ber); |
277 return m_interference.GetErrorRateModel ()->CalculateSnr (txMode, ber); |
257 Ptr<WifiChannel> |
280 Ptr<WifiChannel> |
258 YansWifiPhy::GetChannel (void) const |
281 YansWifiPhy::GetChannel (void) const |
259 { |
282 { |
260 return m_channel; |
283 return m_channel; |
261 } |
284 } |
262 |
|
263 void |
285 void |
264 YansWifiPhy::SetChannel (Ptr<YansWifiChannel> channel) |
286 YansWifiPhy::SetChannel (Ptr<YansWifiChannel> channel) |
265 { |
287 { |
266 m_channel = channel; |
288 m_channel = channel; |
|
289 m_channel->Add (this); |
267 } |
290 } |
268 |
291 |
269 void |
292 void |
270 YansWifiPhy::SetReceiveOkCallback (SyncOkCallback callback) |
293 YansWifiPhy::SetReceiveOkCallback (SyncOkCallback callback) |
271 { |
294 { |