LEFT | RIGHT |
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) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> | 18 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
19 * Sébastien Deronne <sebastien.deronne@gmail.com> | 19 * Sébastien Deronne <sebastien.deronne@gmail.com> |
20 */ | 20 */ |
21 | 21 |
22 #ifndef WIFI_PHY_H | 22 #ifndef WIFI_PHY_H |
23 #define WIFI_PHY_H | 23 #define WIFI_PHY_H |
24 | 24 |
25 #include <map> | |
26 #include "ns3/callback.h" | |
27 #include "ns3/event-id.h" | 25 #include "ns3/event-id.h" |
28 #include "ns3/mobility-model.h" | 26 #include "wifi-mpdu-type.h" |
29 #include "ns3/random-variable-stream.h" | |
30 #include "ns3/channel.h" | |
31 #include "wifi-phy-standard.h" | 27 #include "wifi-phy-standard.h" |
32 #include "interference-helper.h" | 28 #include "interference-helper.h" |
33 #include "ns3/node.h" | 29 #include "wifi-phy-state-helper.h" |
34 #include "ns3/string.h" | |
35 | 30 |
36 namespace ns3 { | 31 namespace ns3 { |
37 | 32 |
38 #define HE_PHY 125 | 33 #define HE_PHY 125 |
39 #define VHT_PHY 126 | 34 #define VHT_PHY 126 |
40 #define HT_PHY 127 | 35 #define HT_PHY 127 |
41 | 36 |
42 /** | 37 class Channel; |
43 * WifiPhyStateHelper class | 38 class NetDevice; |
44 */ | 39 class MobilityModel; |
45 class WifiPhyStateHelper; | 40 class WifiPhyStateHelper; |
46 | |
47 /** | |
48 * FrameCaptureModel class | |
49 */ | |
50 class FrameCaptureModel; | 41 class FrameCaptureModel; |
51 | |
52 /** | |
53 * WifiRadioEnergyModel class | |
54 */ | |
55 class WifiRadioEnergyModel; | 42 class WifiRadioEnergyModel; |
56 ···· | 43 class UniformRandomVariable; |
57 /** | |
58 * This enumeration defines the type of an MPDU. | |
59 */ | |
60 /// MpduType enumeration | |
61 enum MpduType | |
62 { | |
63 /** The MPDU is not part of an A-MPDU */ | |
64 NORMAL_MPDU = 0, | |
65 /** The MPDU is part of an A-MPDU, but is not the last aggregate */ | |
66 MPDU_IN_AGGREGATE, | |
67 /** The MPDU is the last aggregate in an A-MPDU */ | |
68 LAST_MPDU_IN_AGGREGATE | |
69 }; | |
70 | 44 |
71 /// SignalNoiseDbm structure | 45 /// SignalNoiseDbm structure |
72 struct SignalNoiseDbm | 46 struct SignalNoiseDbm |
73 { | 47 { |
74 double signal; ///< in dBm | 48 double signal; ///< in dBm |
75 double noise; ///< in dBm | 49 double noise; ///< in dBm |
76 }; | 50 }; |
77 | 51 |
78 /// MpduInfo structure | 52 /// MpduInfo structure |
79 struct MpduInfo | 53 struct MpduInfo |
80 { | 54 { |
81 MpduType type; ///< type | 55 MpduType type; ///< type |
82 uint32_t mpduRefNumber; ///< MPDU ref number | 56 uint32_t mpduRefNumber; ///< MPDU ref number |
83 }; | 57 }; |
84 | |
85 /** | |
86 * \brief receive notifications about phy events. | |
87 */ | |
88 class WifiPhyListener | |
89 { | |
90 public: | |
91 virtual ~WifiPhyListener (); | |
92 | |
93 /** | |
94 * \param duration the expected duration of the packet reception. | |
95 * | |
96 * We have received the first bit of a packet. We decided | |
97 * that we could synchronize on this packet. It does not mean | |
98 * we will be able to successfully receive completely the | |
99 * whole packet. It means that we will report a BUSY status until | |
100 * one of the following happens: | |
101 * - NotifyRxEndOk | |
102 * - NotifyRxEndError | |
103 * - NotifyTxStart | |
104 */ | |
105 virtual void NotifyRxStart (Time duration) = 0; | |
106 /** | |
107 * We have received the last bit of a packet for which | |
108 * NotifyRxStart was invoked first and, the packet has | |
109 * been successfully received. | |
110 */ | |
111 virtual void NotifyRxEndOk (void) = 0; | |
112 /** | |
113 * We have received the last bit of a packet for which | |
114 * NotifyRxStart was invoked first and, the packet has | |
115 * _not_ been successfully received. | |
116 */ | |
117 virtual void NotifyRxEndError (void) = 0; | |
118 /** | |
119 * \param duration the expected transmission duration. | |
120 * \param txPowerDbm the nominal tx power in dBm | |
121 * | |
122 * We are about to send the first bit of the packet. | |
123 * We do not send any event to notify the end of | |
124 * transmission. Listeners should assume that the | |
125 * channel implicitely reverts to the idle state | |
126 * unless they have received a cca busy report. | |
127 */ | |
128 virtual void NotifyTxStart (Time duration, double txPowerDbm) = 0; | |
129 /** | |
130 * \param duration the expected busy duration. | |
131 * | |
132 * This method does not really report a real state | |
133 * change as opposed to the other methods in this class. | |
134 * It merely reports that, unless the medium is reported | |
135 * busy through NotifyTxStart or NotifyRxStart/End, | |
136 * it will be busy as defined by the currently selected | |
137 * CCA mode. | |
138 * | |
139 * Typical client code which wants to have a clear picture | |
140 * of the CCA state will need to keep track of the time at | |
141 * which the last NotifyCcaBusyStart method is called and | |
142 * what duration it reported. | |
143 */ | |
144 virtual void NotifyMaybeCcaBusyStart (Time duration) = 0; | |
145 /** | |
146 * \param duration the expected channel switching duration. | |
147 * | |
148 * We do not send any event to notify the end of | |
149 * channel switching. Listeners should assume that the | |
150 * channel implicitely reverts to the idle or busy states. | |
151 */ | |
152 virtual void NotifySwitchingStart (Time duration) = 0; | |
153 /** | |
154 * Notify listeners that we went to sleep | |
155 */ | |
156 virtual void NotifySleep (void) = 0; | |
157 /** | |
158 * Notify listeners that we went to switch off | |
159 */ | |
160 virtual void NotifyOff (void) = 0; | |
161 /** | |
162 * Notify listeners that we woke up | |
163 */ | |
164 virtual void NotifyWakeup (void) = 0; | |
165 }; | |
166 | |
167 | 58 |
168 /** | 59 /** |
169 * \brief 802.11 PHY layer model | 60 * \brief 802.11 PHY layer model |
170 * \ingroup wifi | 61 * \ingroup wifi |
171 * | 62 * |
172 */ | 63 */ |
173 class WifiPhy : public Object | 64 class WifiPhy : public Object |
174 { | 65 { |
175 public: | 66 public: |
176 /** | 67 /** |
177 * The state of the PHY layer. | |
178 */ | |
179 /// State enumeration | |
180 enum State | |
181 { | |
182 /** | |
183 * The PHY layer is IDLE. | |
184 */ | |
185 IDLE, | |
186 /** | |
187 * The PHY layer has sense the medium busy through the CCA mechanism | |
188 */ | |
189 CCA_BUSY, | |
190 /** | |
191 * The PHY layer is sending a packet. | |
192 */ | |
193 TX, | |
194 /** | |
195 * The PHY layer is receiving a packet. | |
196 */ | |
197 RX, | |
198 /** | |
199 * The PHY layer is switching to other channel. | |
200 */ | |
201 SWITCHING, | |
202 /** | |
203 * The PHY layer is sleeping. | |
204 */ | |
205 SLEEP, | |
206 /** | |
207 * The PHY layer is switched off. | |
208 */ | |
209 OFF | |
210 }; | |
211 | |
212 /** | |
213 * arg1: packet received successfully | |
214 * arg2: snr of packet | |
215 * arg3: TXVECTOR of packet | |
216 * arg4: type of preamble used for packet. | |
217 */ | |
218 typedef Callback<void, Ptr<Packet>, double, WifiTxVector> RxOkCallback; | |
219 /** | |
220 * arg1: packet received unsuccessfully | |
221 * arg2: snr of packet | |
222 */ | |
223 typedef Callback<void, Ptr<Packet>, double> RxErrorCallback; | |
224 | |
225 /** | |
226 * \brief Get the type ID. | 68 * \brief Get the type ID. |
227 * \return the object TypeId | 69 * \return the object TypeId |
228 */ | 70 */ |
229 static TypeId GetTypeId (void); | 71 static TypeId GetTypeId (void); |
230 | 72 |
231 WifiPhy (); | 73 WifiPhy (); |
232 virtual ~WifiPhy (); | 74 virtual ~WifiPhy (); |
233 | 75 |
234 /** | 76 /** |
235 * \param callback the callback to invoke | 77 * \param callback the callback to invoke |
(...skipping 13 matching lines...) Expand all Loading... |
249 * PHY-level events. | 91 * PHY-level events. |
250 */ | 92 */ |
251 void RegisterListener (WifiPhyListener *listener); | 93 void RegisterListener (WifiPhyListener *listener); |
252 /** | 94 /** |
253 * \param listener the listener to be unregistered | 95 * \param listener the listener to be unregistered |
254 * | 96 * |
255 * Remove the input listener from the list of objects to be notified of | 97 * Remove the input listener from the list of objects to be notified of |
256 * PHY-level events. | 98 * PHY-level events. |
257 */ | 99 */ |
258 void UnregisterListener (WifiPhyListener *listener); | 100 void UnregisterListener (WifiPhyListener *listener); |
| 101 |
| 102 /** |
| 103 * \param callback the callback to invoke when PHY capabilities have changed. |
| 104 */ |
| 105 void SetCapabilitiesChangedCallback (Callback<void> callback); |
259 | 106 |
260 /** | 107 /** |
261 * Starting receiving the plcp of a packet (i.e. the first bit of the preamble
has arrived). | 108 * Starting receiving the plcp of a packet (i.e. the first bit of the preamble
has arrived). |
262 * | 109 * |
263 * \param packet the arriving packet | 110 * \param packet the arriving packet |
264 * \param rxPowerW the receive power in W | 111 * \param rxPowerW the receive power in W |
265 * \param rxDuration the duration needed for the reception of the packet | 112 * \param rxDuration the duration needed for the reception of the packet |
266 */ | 113 */ |
267 void StartReceivePreambleAndHeader (Ptr<Packet> packet, | 114 void StartReceivePreambleAndHeader (Ptr<Packet> packet, |
268 double rxPowerW, | 115 double rxPowerW, |
269 Time rxDuration); | 116 Time rxDuration); |
270 | 117 |
271 /** | 118 /** |
272 * Starting receiving the payload of a packet (i.e. the first bit of the packe
t has arrived). | 119 * Starting receiving the payload of a packet (i.e. the first bit of the packe
t has arrived). |
273 * | 120 * |
274 * \param packet the arriving packet | 121 * \param packet the arriving packet |
275 * \param txVector the TXVECTOR of the arriving packet | 122 * \param txVector the TXVECTOR of the arriving packet |
276 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. | 123 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. |
277 * \param event the corresponding event of the first time the packet arrives | 124 * \param event the corresponding event of the first time the packet arrives |
278 */ | 125 */ |
279 void StartReceivePacket (Ptr<Packet> packet, | 126 void StartReceivePacket (Ptr<Packet> packet, |
280 WifiTxVector txVector, | 127 WifiTxVector txVector, |
281 MpduType mpdutype, | 128 MpduType mpdutype, |
282 Ptr<InterferenceHelper::Event> event); | 129 Ptr<Event> event); |
283 | 130 |
284 /** | 131 /** |
285 * The last bit of the packet has arrived. | 132 * The last bit of the packet has arrived. |
286 * | 133 * |
287 * \param packet the packet that the last bit has arrived | 134 * \param packet the packet that the last bit has arrived |
288 * \param preamble the preamble of the arriving packet | 135 * \param preamble the preamble of the arriving packet |
289 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. | 136 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. |
290 * \param event the corresponding event of the first time the packet arrives | 137 * \param event the corresponding event of the first time the packet arrives |
291 */ | 138 */ |
292 void EndReceive (Ptr<Packet> packet, WifiPreamble preamble, MpduType mpdutype,
Ptr<InterferenceHelper::Event> event); | 139 void EndReceive (Ptr<Packet> packet, WifiPreamble preamble, MpduType mpdutype,
Ptr<Event> event); |
293 | 140 |
294 /** | 141 /** |
295 * \param packet the packet to send | 142 * \param packet the packet to send |
296 * \param txVector the TXVECTOR that has tx parameters such as mode, the trans
mission mode to use to send | 143 * \param txVector the TXVECTOR that has tx parameters such as mode, the trans
mission mode to use to send |
297 * this packet, and txPowerLevel, a power level to use to send this pac
ket. The real transmission | 144 * this packet, and txPowerLevel, a power level to use to send this pac
ket. The real transmission |
298 * power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txP
owerMin) / nTxLevels | 145 * power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txP
owerMin) / nTxLevels |
299 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. | 146 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. |
300 */ | 147 */ |
301 void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpd
utype = NORMAL_MPDU); | 148 void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpd
utype = NORMAL_MPDU); |
302 | 149 |
(...skipping 11 matching lines...) Expand all Loading... |
314 */ | 161 */ |
315 void SetSleepMode (void); | 162 void SetSleepMode (void); |
316 /** | 163 /** |
317 * Resume from sleep mode. | 164 * Resume from sleep mode. |
318 */ | 165 */ |
319 void ResumeFromSleep (void); | 166 void ResumeFromSleep (void); |
320 /** | 167 /** |
321 * Put in off mode. | 168 * Put in off mode. |
322 */ | 169 */ |
323 void SetOffMode (void); | 170 void SetOffMode (void); |
| 171 /** |
| 172 * Resume from off mode. |
| 173 */ |
| 174 void ResumeFromOff (void); |
324 | 175 |
325 /** | 176 /** |
326 * \return true of the current state of the PHY layer is WifiPhy::IDLE, false
otherwise. | 177 * \return true of the current state of the PHY layer is WifiPhy::IDLE, false
otherwise. |
327 */ | 178 */ |
328 bool IsStateIdle (void) const; | 179 bool IsStateIdle (void) const; |
329 /** | 180 /** |
330 * \return true of the current state of the PHY layer is WifiPhy::CCA_BUSY, fa
lse otherwise. | 181 * \return true of the current state of the PHY layer is WifiPhy::CCA_BUSY, fa
lse otherwise. |
331 */ | 182 */ |
332 bool IsStateCcaBusy (void) const; | 183 bool IsStateCcaBusy (void) const; |
333 /** | 184 /** |
334 * \return true of the current state of the PHY layer is not WifiPhy::IDLE, fa
lse otherwise. | |
335 */ | |
336 bool IsStateBusy (void) const; | |
337 /** | |
338 * \return true of the current state of the PHY layer is WifiPhy::RX, false ot
herwise. | 185 * \return true of the current state of the PHY layer is WifiPhy::RX, false ot
herwise. |
339 */ | 186 */ |
340 bool IsStateRx (void) const; | 187 bool IsStateRx (void) const; |
341 /** | 188 /** |
342 * \return true of the current state of the PHY layer is WifiPhy::TX, false ot
herwise. | 189 * \return true of the current state of the PHY layer is WifiPhy::TX, false ot
herwise. |
343 */ | 190 */ |
344 bool IsStateTx (void) const; | 191 bool IsStateTx (void) const; |
345 /** | 192 /** |
346 * \return true of the current state of the PHY layer is WifiPhy::SWITCHING, f
alse otherwise. | 193 * \return true of the current state of the PHY layer is WifiPhy::SWITCHING, f
alse otherwise. |
347 */ | 194 */ |
348 bool IsStateSwitching (void) const; | 195 bool IsStateSwitching (void) const; |
349 /** | 196 /** |
350 * \return true if the current state of the PHY layer is WifiPhy::SLEEP, false
otherwise. | 197 * \return true if the current state of the PHY layer is WifiPhy::SLEEP, false
otherwise. |
351 */ | 198 */ |
352 bool IsStateSleep (void) const; | 199 bool IsStateSleep (void) const; |
353 /** | 200 /** |
354 * \return true if the current state of the PHY layer is WifiPhy::OFF, false o
therwise. | 201 * \return true if the current state of the PHY layer is WifiPhy::OFF, false o
therwise. |
355 */ | 202 */ |
356 bool IsStateOff (void) const ; | 203 bool IsStateOff (void) const; |
357 | 204 |
358 /** | |
359 * \return the amount of time since the current state has started. | |
360 */ | |
361 Time GetStateDuration (void); | |
362 /** | 205 /** |
363 * \return the predicted delay until this PHY can become WifiPhy::IDLE. | 206 * \return the predicted delay until this PHY can become WifiPhy::IDLE. |
364 * | 207 * |
365 * The PHY will never become WifiPhy::IDLE _before_ the delay returned by | 208 * The PHY will never become WifiPhy::IDLE _before_ the delay returned by |
366 * this method but it could become really idle later. | 209 * this method but it could become really idle later. |
367 */ | 210 */ |
368 Time GetDelayUntilIdle (void); | 211 Time GetDelayUntilIdle (void); |
369 | 212 |
370 /** | 213 /** |
371 * Return the start time of the last received packet. | 214 * Return the start time of the last received packet. |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 * transmission/reception modes that this WifiPhy(-derived class) | 405 * transmission/reception modes that this WifiPhy(-derived class) |
563 * can support - a set of WifiMode objects which we call the | 406 * can support - a set of WifiMode objects which we call the |
564 * BssMembershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSel
ectorSet. | 407 * BssMembershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSel
ectorSet. |
565 * | 408 * |
566 * \param selector index in array of supported memberships | 409 * \param selector index in array of supported memberships |
567 * | 410 * |
568 * \return the memebership selector whose index is specified. | 411 * \return the memebership selector whose index is specified. |
569 */ | 412 */ |
570 uint8_t GetBssMembershipSelector (uint8_t selector) const; | 413 uint8_t GetBssMembershipSelector (uint8_t selector) const; |
571 /** | 414 /** |
572 * The WifiPhy::GetMembershipSelectorModes() method is used | |
573 * (e.g., by a WifiRemoteStationManager) to determine the set of | |
574 * transmission/reception modes that this WifiPhy(-derived class) | |
575 * can support - a set of WifiMode objects which we call the | |
576 * BssMembershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSe
lectorSet. | |
577 * | |
578 * \param selector index in array of supported memberships | |
579 * | |
580 * \return a WifiModeList that contains the WifiModes associrated with the sel
ected index. | |
581 * | |
582 * \sa WifiPhy::GetMembershipSelectorModes() | |
583 */ | |
584 WifiModeList GetMembershipSelectorModes (uint32_t selector); | |
585 /** | |
586 * The WifiPhy::GetNMcs() method is used | 415 * The WifiPhy::GetNMcs() method is used |
587 * (e.g., by a WifiRemoteStationManager) to determine the set of | 416 * (e.g., by a WifiRemoteStationManager) to determine the set of |
588 * transmission/reception MCS indexes that this WifiPhy(-derived class) | 417 * transmission/reception MCS indexes that this WifiPhy(-derived class) |
589 * can support - a set of MCS indexes which we call the | 418 * can support - a set of MCS indexes which we call the |
590 * DeviceMcsSet, and which is stored as WifiPhy::m_deviceMcsSet. | 419 * DeviceMcsSet, and which is stored as WifiPhy::m_deviceMcsSet. |
591 * | 420 * |
592 * \return the MCS index whose index is specified. | 421 * \return the MCS index whose index is specified. |
593 */ | 422 */ |
594 uint8_t GetNMcs (void) const; | 423 uint8_t GetNMcs (void) const; |
595 /** | 424 /** |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 * If the channel is not already defined for the standard, the method | 480 * If the channel is not already defined for the standard, the method |
652 * should return true; otherwise false. | 481 * should return true; otherwise false. |
653 * | 482 * |
654 * \param channelNumber the channel number to define | 483 * \param channelNumber the channel number to define |
655 * \param standard the applicable WifiPhyStandard | 484 * \param standard the applicable WifiPhyStandard |
656 * \param frequency the frequency (MHz) | 485 * \param frequency the frequency (MHz) |
657 * \param channelWidth the channel width (MHz) | 486 * \param channelWidth the channel width (MHz) |
658 * | 487 * |
659 * \return true if the channel definition succeeded | 488 * \return true if the channel definition succeeded |
660 */ | 489 */ |
661 bool DefineChannelNumber (uint8_t channelNumber, WifiPhyStandard standard, uin
t16_t frequency, uint8_t channelWidth); | 490 bool DefineChannelNumber (uint8_t channelNumber, WifiPhyStandard standard, uin
t16_t frequency, uint16_t channelWidth); |
662 | 491 |
663 /** | 492 /** |
664 * A pair of a ChannelNumber and WifiPhyStandard | 493 * A pair of a ChannelNumber and WifiPhyStandard |
665 */ | 494 */ |
666 typedef std::pair<uint8_t, WifiPhyStandard> ChannelNumberStandardPair; | 495 typedef std::pair<uint8_t, WifiPhyStandard> ChannelNumberStandardPair; |
667 /** | 496 /** |
668 * A pair of a center Frequency and a ChannelWidth | 497 * A pair of a center Frequency and a ChannelWidth |
669 */ | 498 */ |
670 typedef std::pair<uint16_t, uint8_t> FrequencyWidthPair; | 499 typedef std::pair<uint16_t, uint16_t> FrequencyWidthPair; |
671 | 500 |
672 /** | 501 /** |
673 * Return the Channel this WifiPhy is connected to. | 502 * Return the Channel this WifiPhy is connected to. |
674 * | 503 * |
675 * \return the Channel this WifiPhy is connected to | 504 * \return the Channel this WifiPhy is connected to |
676 */ | 505 */ |
677 virtual Ptr<Channel> GetChannel (void) const = 0; | 506 virtual Ptr<Channel> GetChannel (void) const = 0; |
678 | 507 |
679 /** | 508 /** |
680 * Return a WifiMode for DSSS at 1Mbps. | 509 * Return a WifiMode for DSSS at 1Mbps. |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 * \param threshold the energy detction threshold in dBm | 1191 * \param threshold the energy detction threshold in dBm |
1363 */ | 1192 */ |
1364 void SetEdThreshold (double threshold); | 1193 void SetEdThreshold (double threshold); |
1365 /** | 1194 /** |
1366 * Return the energy detection threshold (dBm). | 1195 * Return the energy detection threshold (dBm). |
1367 * | 1196 * |
1368 * \return the energy detection threshold in dBm | 1197 * \return the energy detection threshold in dBm |
1369 */ | 1198 */ |
1370 double GetEdThreshold (void) const; | 1199 double GetEdThreshold (void) const; |
1371 /** | 1200 /** |
1372 * Return the energy detection threshold. | |
1373 * | |
1374 * \return the energy detection threshold. | |
1375 */ | |
1376 double GetEdThresholdW (void) const; | |
1377 /** | |
1378 * Sets the CCA threshold (dBm). The energy of a received signal | 1201 * Sets the CCA threshold (dBm). The energy of a received signal |
1379 * should be higher than this threshold to allow the PHY | 1202 * should be higher than this threshold to allow the PHY |
1380 * layer to declare CCA BUSY state. | 1203 * layer to declare CCA BUSY state. |
1381 * | 1204 * |
1382 * \param threshold the CCA threshold in dBm | 1205 * \param threshold the CCA threshold in dBm |
1383 */ | 1206 */ |
1384 void SetCcaMode1Threshold (double threshold); | 1207 void SetCcaMode1Threshold (double threshold); |
1385 /** | 1208 /** |
1386 * Return the CCA threshold (dBm). | 1209 * Return the CCA threshold (dBm). |
1387 * | 1210 * |
1388 * \return the CCA threshold in dBm | 1211 * \return the CCA threshold in dBm |
1389 */ | 1212 */ |
1390 double GetCcaMode1Threshold (void) const; | 1213 double GetCcaMode1Threshold (void) const; |
1391 /** | 1214 /** |
1392 * Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in
the receiver. | 1215 * Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in
the receiver. |
1393 * | 1216 * |
1394 * \param noiseFigureDb noise figure in dB | 1217 * \param noiseFigureDb noise figure in dB |
1395 */ | 1218 */ |
1396 void SetRxNoiseFigure (double noiseFigureDb); | 1219 void SetRxNoiseFigure (double noiseFigureDb); |
1397 /** | |
1398 * Return the RX noise figure (dBm). | |
1399 * | |
1400 * \return the RX noise figure in dBm | |
1401 */ | |
1402 double GetRxNoiseFigure (void) const; | |
1403 /** | 1220 /** |
1404 * Sets the minimum available transmission power level (dBm). | 1221 * Sets the minimum available transmission power level (dBm). |
1405 * | 1222 * |
1406 * \param start the minimum transmission power level (dBm) | 1223 * \param start the minimum transmission power level (dBm) |
1407 */ | 1224 */ |
1408 void SetTxPowerStart (double start); | 1225 void SetTxPowerStart (double start); |
1409 /** | 1226 /** |
1410 * Return the minimum available transmission power level (dBm). | 1227 * Return the minimum available transmission power level (dBm). |
1411 * | 1228 * |
1412 * \return the minimum available transmission power level (dBm) | 1229 * \return the minimum available transmission power level (dBm) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 */ | 1414 */ |
1598 bool GetShortPlcpPreambleSupported (void) const; | 1415 bool GetShortPlcpPreambleSupported (void) const; |
1599 | 1416 |
1600 /** | 1417 /** |
1601 * Sets the error rate model. | 1418 * Sets the error rate model. |
1602 * | 1419 * |
1603 * \param rate the error rate model | 1420 * \param rate the error rate model |
1604 */ | 1421 */ |
1605 void SetErrorRateModel (const Ptr<ErrorRateModel> rate); | 1422 void SetErrorRateModel (const Ptr<ErrorRateModel> rate); |
1606 /** | 1423 /** |
1607 * Return the error rate model this PHY is using. | |
1608 * | |
1609 * \return the error rate model this PHY is using | |
1610 */ | |
1611 Ptr<ErrorRateModel> GetErrorRateModel (void) const; | |
1612 | |
1613 /** | |
1614 * Sets the frame capture model. | 1424 * Sets the frame capture model. |
1615 * | 1425 * |
1616 * \param frameCaptureModel the frame capture model | 1426 * \param frameCaptureModel the frame capture model |
1617 */ | 1427 */ |
1618 void SetFrameCaptureModel (const Ptr<FrameCaptureModel> frameCaptureModel); | 1428 void SetFrameCaptureModel (const Ptr<FrameCaptureModel> frameCaptureModel); |
1619 /** | 1429 /** |
1620 * Return the frame capture model this PHY is using. | |
1621 * | |
1622 * \return the frame capture model this PHY is using | |
1623 */ | |
1624 Ptr<FrameCaptureModel> GetFrameCaptureModel (void) const; | |
1625 | |
1626 /** | |
1627 * Sets the wifi radio energy model. | 1430 * Sets the wifi radio energy model. |
1628 * | 1431 * |
1629 * \param wifiRadioEnergyModel the wifi radio energy model | 1432 * \param wifiRadioEnergyModel the wifi radio energy model |
1630 */ | 1433 */ |
1631 void SetWifiRadioEnergyModel (const Ptr<WifiRadioEnergyModel> wifiRadioEnergyM
odel); | 1434 void SetWifiRadioEnergyModel (const Ptr<WifiRadioEnergyModel> wifiRadioEnergyM
odel); |
1632 | 1435 |
1633 /** | 1436 /** |
1634 * \return the channel width | 1437 * \return the channel width |
1635 */ | 1438 */ |
1636 uint8_t GetChannelWidth (void) const; | 1439 uint16_t GetChannelWidth (void) const; |
1637 /** | 1440 /** |
1638 * \param channelwidth channel width | 1441 * \param channelwidth channel width |
1639 */ | 1442 */ |
1640 virtual void SetChannelWidth (uint8_t channelwidth); | 1443 virtual void SetChannelWidth (uint16_t channelwidth); |
1641 /** | 1444 /** |
1642 * \param channelwidth channel width (in MHz) to support | 1445 * \param channelwidth channel width (in MHz) to support |
1643 */ | 1446 */ |
1644 void AddSupportedChannelWidth (uint8_t channelwidth); | 1447 void AddSupportedChannelWidth (uint16_t channelwidth); |
1645 /** | 1448 /** |
1646 * \return a vector containing the supported channel widths, values in MHz | 1449 * \return a vector containing the supported channel widths, values in MHz |
1647 */ | 1450 */ |
1648 std::vector<uint8_t> GetSupportedChannelWidthSet (void) const; | 1451 std::vector<uint16_t> GetSupportedChannelWidthSet (void) const; |
1649 | 1452 |
1650 /** | 1453 /** |
1651 * Get the power of the given power level in dBm. | 1454 * Get the power of the given power level in dBm. |
1652 * In SpectrumWifiPhy implementation, the power levels are equally spaced (in
dBm). | 1455 * In SpectrumWifiPhy implementation, the power levels are equally spaced (in
dBm). |
1653 * | 1456 * |
1654 * \param power the power level | 1457 * \param power the power level |
1655 * | 1458 * |
1656 * \return the transmission power in dBm at the given power level | 1459 * \return the transmission power in dBm at the given power level |
1657 */ | 1460 */ |
1658 double GetPowerDbm (uint8_t power) const; | 1461 double GetPowerDbm (uint8_t power) const; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 * \param standard the Wi-Fi standard | 1586 * \param standard the Wi-Fi standard |
1784 */ | 1587 */ |
1785 void ConfigureChannelForStandard (WifiPhyStandard standard); | 1588 void ConfigureChannelForStandard (WifiPhyStandard standard); |
1786 | 1589 |
1787 /** | 1590 /** |
1788 * Look for channel number matching the frequency and width | 1591 * Look for channel number matching the frequency and width |
1789 * \param frequency The center frequency to use | 1592 * \param frequency The center frequency to use |
1790 * \param width The channel width to use | 1593 * \param width The channel width to use |
1791 * \return the channel number if found, zero if not | 1594 * \return the channel number if found, zero if not |
1792 */ | 1595 */ |
1793 uint8_t FindChannelNumberForFrequencyWidth (uint16_t frequency, uint8_t width)
const; | 1596 uint8_t FindChannelNumberForFrequencyWidth (uint16_t frequency, uint16_t width
) const; |
1794 /** | 1597 /** |
1795 * Lookup frequency/width pair for channelNumber/standard pair | 1598 * Lookup frequency/width pair for channelNumber/standard pair |
1796 * \param channelNumber The channel number to check | 1599 * \param channelNumber The channel number to check |
1797 * \param standard The WifiPhyStandard to check | 1600 * \param standard The WifiPhyStandard to check |
1798 * \return the FrequencyWidthPair found | 1601 * \return the FrequencyWidthPair found |
1799 */ | 1602 */ |
1800 FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard (uint8_t channelN
umber, WifiPhyStandard standard) const; | 1603 FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard (uint8_t channelN
umber, WifiPhyStandard standard) const; |
1801 | 1604 |
1802 /** | 1605 /** |
1803 * Due to newly arrived signal, the current reception cannot be continued and
has to be aborted | 1606 * Due to newly arrived signal, the current reception cannot be continued and
has to be aborted |
1804 * | 1607 * |
1805 */ | 1608 */ |
1806 void AbortCurrentReception (void); | 1609 void AbortCurrentReception (void); |
1807 | 1610 |
1808 /** | 1611 /** |
1809 * Eventually switch to CCA busy | 1612 * Eventually switch to CCA busy |
1810 */ | 1613 */ |
1811 void MaybeCcaBusyDuration (void); | 1614 void MaybeCcaBusyDuration (void); |
1812 | 1615 |
1813 /** | 1616 /** |
1814 * Starting receiving the packet after having detected the medium is idle or a
fter a reception switch. | 1617 * Starting receiving the packet after having detected the medium is idle or a
fter a reception switch. |
1815 * | 1618 * |
1816 * \param packet the arriving packet | 1619 * \param packet the arriving packet |
1817 * \param txVector the TXVECTOR of the arriving packet | 1620 * \param txVector the TXVECTOR of the arriving packet |
1818 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. | 1621 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. |
1819 * \param rxPowerW the receive power in W | 1622 * \param rxPowerW the receive power in W |
1820 * \param rxDuration the duration needed for the reception of the packet | 1623 * \param rxDuration the duration needed for the reception of the packet |
1821 * \param event the corresponding event of the first time the packet arrives | 1624 * \param event the corresponding event of the first time the packet arrives |
1822 */ | 1625 */ |
1823 void StartRx (Ptr<Packet> packet, | 1626 void StartRx (Ptr<Packet> packet, |
1824 WifiTxVector txVector, | 1627 WifiTxVector txVector, |
1825 MpduType mpdutype, | 1628 MpduType mpdutype, |
1826 double rxPowerW, | 1629 double rxPowerW, |
1827 Time rxDuration, | 1630 Time rxDuration, |
1828 Ptr<InterferenceHelper::Event> event); | 1631 Ptr<Event> event); |
1829 | 1632 |
1830 /** | 1633 /** |
1831 * The trace source fired when a packet begins the transmission process on | 1634 * The trace source fired when a packet begins the transmission process on |
1832 * the medium. | 1635 * the medium. |
1833 * | 1636 * |
1834 * \see class CallBackTraceSource | 1637 * \see class CallBackTraceSource |
1835 */ | 1638 */ |
1836 TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace; | 1639 TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace; |
1837 | 1640 |
1838 /** | 1641 /** |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 * however, something that we need to keep in mind for the | 1739 * however, something that we need to keep in mind for the |
1937 * future. Basically, the key point is that we can't be making | 1740 * future. Basically, the key point is that we can't be making |
1938 * assumptions like "the Operational Rate Set will contain all the | 1741 * assumptions like "the Operational Rate Set will contain all the |
1939 * mandatory rates". | 1742 * mandatory rates". |
1940 */ | 1743 */ |
1941 WifiModeList m_deviceRateSet; | 1744 WifiModeList m_deviceRateSet; |
1942 WifiModeList m_deviceMcsSet; //!< the device MCS set | 1745 WifiModeList m_deviceMcsSet; //!< the device MCS set |
1943 | 1746 |
1944 std::vector<uint8_t> m_bssMembershipSelectorSet; //!< the BSS membership selec
tor set | 1747 std::vector<uint8_t> m_bssMembershipSelectorSet; //!< the BSS membership selec
tor set |
1945 | 1748 |
1946 WifiPhyStandard m_standard; //!< WifiPhyStandard | 1749 WifiPhyStandard m_standard; //!< WifiPhyStandard |
1947 bool m_isConstructed; //!< true when ready to set frequency | 1750 bool m_isConstructed; //!< true when ready to set frequenc
y |
1948 uint16_t m_channelCenterFrequency; //!< Center frequency in MHz | 1751 uint16_t m_channelCenterFrequency; //!< Center frequency in MHz |
1949 uint16_t m_initialFrequency; //!< Store frequency until initialization | 1752 uint16_t m_initialFrequency; //!< Store frequency until initializ
ation |
1950 bool m_frequencyChannelNumberInitialized; //!< Store initialization state | 1753 bool m_frequencyChannelNumberInitialized; //!< Store initialization state |
1951 uint8_t m_channelWidth; //!< Channel width | 1754 uint16_t m_channelWidth; //!< Channel width |
1952 | 1755 |
1953 double m_edThresholdW; //!< Energy detection threshold in watts | 1756 double m_edThresholdW; //!< Energy detection threshold in watts |
1954 double m_ccaMode1ThresholdW; //!< Clear channel assessment (CCA) threshold
in watts | 1757 double m_ccaMode1ThresholdW; //!< Clear channel assessment (CCA) threshold
in watts |
1955 double m_txGainDb; //!< Transmission gain (dB) | 1758 double m_txGainDb; //!< Transmission gain (dB) |
1956 double m_rxGainDb; //!< Reception gain (dB) | 1759 double m_rxGainDb; //!< Reception gain (dB) |
1957 double m_txPowerBaseDbm; //!< Minimum transmission power (dBm) | 1760 double m_txPowerBaseDbm; //!< Minimum transmission power (dBm) |
1958 double m_txPowerEndDbm; //!< Maximum transmission power (dBm) | 1761 double m_txPowerEndDbm; //!< Maximum transmission power (dBm) |
1959 uint8_t m_nTxPower; //!< Number of available transmission power le
vels | 1762 uint8_t m_nTxPower; //!< Number of available transmission power le
vels |
1960 | 1763 |
1961 bool m_ldpc; //!< Flag if LDPC is used | 1764 bool m_ldpc; //!< Flag if LDPC is used |
1962 bool m_stbc; //!< Flag if STBC is used | 1765 bool m_stbc; //!< Flag if STBC is used |
1963 bool m_greenfield; //!< Flag if GreenField format is supported | 1766 bool m_greenfield; //!< Flag if GreenField format is supported |
1964 bool m_shortGuardInterval; //!< Flag if HT/VHT short guard interval is
supported | 1767 bool m_shortGuardInterval; //!< Flag if HT/VHT short guard interval is sup
ported |
1965 bool m_shortPreamble; //!< Flag if short PLCP preamble is supporte
d | 1768 bool m_shortPreamble; //!< Flag if short PLCP preamble is supported |
1966 | 1769 |
1967 Time m_guardInterval; //!< Supported HE guard interval | 1770 Time m_guardInterval; //!< Supported HE guard interval |
1968 | 1771 |
1969 uint8_t m_numberOfAntennas; //!< Number of transmitters | 1772 uint8_t m_numberOfAntennas; //!< Number of transmitters |
1970 uint8_t m_txSpatialStreams; //!< Number of supported TX spatial streams | 1773 uint8_t m_txSpatialStreams; //!< Number of supported TX spatial streams |
1971 uint8_t m_rxSpatialStreams; //!< Number of supported RX spatial streams | 1774 uint8_t m_rxSpatialStreams; //!< Number of supported RX spatial streams |
1972 | 1775 |
1973 typedef std::map<ChannelNumberStandardPair,FrequencyWidthPair> ChannelToFreque
ncyWidthMap; //!< channel to frequency width map typedef | 1776 typedef std::map<ChannelNumberStandardPair,FrequencyWidthPair> ChannelToFreque
ncyWidthMap; //!< channel to frequency width map typedef |
1974 static ChannelToFrequencyWidthMap m_channelToFrequencyWidth; //!< the channel
to frequency width map | 1777 static ChannelToFrequencyWidthMap m_channelToFrequencyWidth; //!< the channel
to frequency width map |
1975 | 1778 |
1976 std::vector<uint8_t> m_supportedChannelWidthSet; //!< Supported channel width | 1779 std::vector<uint16_t> m_supportedChannelWidthSet; //!< Supported channel width |
1977 uint8_t m_channelNumber; //!< Operating channel number | 1780 uint8_t m_channelNumber; //!< Operating channel numbe
r |
1978 uint8_t m_initialChannelNumber; //!< Initial channel number | 1781 uint8_t m_initialChannelNumber; //!< Initial channel number |
1979 | 1782 |
1980 Time m_channelSwitchDelay; //!< Time required to switch between channel | 1783 Time m_channelSwitchDelay; //!< Time required to switch between channel |
1981 uint32_t m_totalAmpduSize; //!< Total size of the previously transmitted M
PDUs in an A-MPDU, used for the computation of the number of symbols needed for
the last MPDU in the A-MPDU | 1784 uint32_t m_totalAmpduSize; //!< Total size of the previously transmitted M
PDUs in an A-MPDU, used for the computation of the number of symbols needed for
the last MPDU in the A-MPDU |
1982 double m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted f
or the MPDUs in an A-MPDU, used for the computation of the number of symbols nee
ded for the last MPDU in the A-MPDU | 1785 double m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted f
or the MPDUs in an A-MPDU, used for the computation of the number of symbols nee
ded for the last MPDU in the A-MPDU |
1983 | 1786 |
1984 Ptr<NetDevice> m_device; //!< Pointer to the device | 1787 Ptr<NetDevice> m_device; //!< Pointer to the device |
1985 Ptr<MobilityModel> m_mobility; //!< Pointer to the mobility model | 1788 Ptr<MobilityModel> m_mobility; //!< Pointer to the mobility model |
1986 | 1789 |
1987 Ptr<InterferenceHelper::Event> m_currentEvent; //!< Hold the current event | 1790 Ptr<Event> m_currentEvent; //!< Hold the current event |
1988 Ptr<FrameCaptureModel> m_frameCaptureModel; //!< Frame capture model | 1791 Ptr<FrameCaptureModel> m_frameCaptureModel; //!< Frame capture model |
1989 Ptr<WifiRadioEnergyModel> m_wifiRadioEnergyModel; //!< Wifi radio energy model | 1792 Ptr<WifiRadioEnergyModel> m_wifiRadioEnergyModel; //!< Wifi radio energy model |
| 1793 |
| 1794 Callback<void> m_capabilitiesChangedCallback; //!< Callback when PHY capabilit
ies changed |
1990 }; | 1795 }; |
1991 | 1796 |
1992 /** | 1797 /** |
1993 * \param os output stream | 1798 * \param os output stream |
1994 * \param state wifi state to stringify | 1799 * \param state wifi state to stringify |
1995 * \return output stream | 1800 * \return output stream |
1996 */ | 1801 */ |
1997 std::ostream& operator<< (std::ostream& os, WifiPhy::State state); | 1802 std::ostream& operator<< (std::ostream& os, WifiPhyState state); |
1998 | 1803 |
1999 } //namespace ns3 | 1804 } //namespace ns3 |
2000 | 1805 |
2001 #endif /* WIFI_PHY_H */ | 1806 #endif /* WIFI_PHY_H */ |
LEFT | RIGHT |