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 |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include <map> | 25 #include <map> |
26 #include "ns3/callback.h" | 26 #include "ns3/callback.h" |
27 #include "ns3/event-id.h" | 27 #include "ns3/event-id.h" |
28 #include "ns3/mobility-model.h" | 28 #include "ns3/mobility-model.h" |
29 #include "ns3/random-variable-stream.h" | 29 #include "ns3/random-variable-stream.h" |
30 #include "ns3/channel.h" | 30 #include "ns3/channel.h" |
31 #include "wifi-phy-standard.h" | 31 #include "wifi-phy-standard.h" |
32 #include "interference-helper.h" | 32 #include "interference-helper.h" |
33 #include "ns3/node.h" | 33 #include "ns3/node.h" |
34 #include "ns3/string.h" | 34 #include "ns3/string.h" |
| 35 #include "wifi-phy-state.h" |
35 #include "wifi-phy-listener.h" | 36 #include "wifi-phy-listener.h" |
36 #include "wifi-phy-state.h" | |
37 | 37 |
38 namespace ns3 { | 38 namespace ns3 { |
39 | 39 |
40 #define HE_PHY 125 | 40 #define HE_PHY 125 |
41 #define VHT_PHY 126 | 41 #define VHT_PHY 126 |
42 #define HT_PHY 127 | 42 #define HT_PHY 127 |
43 | 43 |
44 /** | 44 /** |
45 * WifiPhyStateHelper class | 45 * WifiPhyStateHelper class |
46 */ | 46 */ |
47 class WifiPhyStateHelper; | 47 class WifiPhyStateHelper; |
48 | 48 |
49 /** | 49 /** |
50 * FrameCaptureModel class | 50 * FrameCaptureModel class |
51 */ | 51 */ |
52 class FrameCaptureModel; | 52 class FrameCaptureModel; |
53 | 53 |
54 /** | 54 /** |
55 * WifiRadioEnergyModel class | 55 * WifiRadioEnergyModel class |
56 */ | 56 */ |
57 class WifiRadioEnergyModel; | 57 class WifiRadioEnergyModel; |
58 | 58 |
59 /** | 59 /** |
60 * This enumeration defines the type of an MPDU. | 60 * This enumeration defines the type of an MPDU. |
61 */ | 61 */ |
62 /// MpduType enumeration | 62 /// MpduType enumeration |
63 enum MpduType | 63 enum MpduType |
64 { | 64 { |
65 /** The MPDU is not part of an A-MPDU */ | 65 /** The MPDU is not part of an A-MPDU */ |
66 NORMAL_MPDU = 0, | 66 NORMAL_MPDU = 0, |
67 /** The MPDU is part of an A-MPDU, but is not the last aggregate */ | 67 /** The MPDU is part of an A-MPDU, but is not the last aggregate */ |
68 MPDU_IN_AGGREGATE, | 68 MPDU_IN_AGGREGATE, |
(...skipping 17 matching lines...) Expand all Loading... |
86 | 86 |
87 /** | 87 /** |
88 * \brief 802.11 PHY layer model | 88 * \brief 802.11 PHY layer model |
89 * \ingroup wifi | 89 * \ingroup wifi |
90 * | 90 * |
91 */ | 91 */ |
92 class WifiPhy : public Object | 92 class WifiPhy : public Object |
93 { | 93 { |
94 public: | 94 public: |
95 /** | 95 /** |
96 * arg1: packet received successfully | |
97 * arg2: snr of packet | |
98 * arg3: TXVECTOR of packet | |
99 * arg4: type of preamble used for packet. | |
100 */ | |
101 typedef Callback<void, Ptr<Packet>, double, WifiTxVector> RxOkCallback; | |
102 /** | |
103 * arg1: packet received unsuccessfully | |
104 * arg2: snr of packet | |
105 */ | |
106 typedef Callback<void, Ptr<Packet>, double> RxErrorCallback; | |
107 | |
108 /** | |
109 * \brief Get the type ID. | 96 * \brief Get the type ID. |
110 * \return the object TypeId | 97 * \return the object TypeId |
111 */ | 98 */ |
112 static TypeId GetTypeId (void); | 99 static TypeId GetTypeId (void); |
113 | 100 |
114 WifiPhy (); | 101 WifiPhy (); |
115 virtual ~WifiPhy (); | 102 virtual ~WifiPhy (); |
116 | 103 |
117 /** | 104 /** |
118 * \param callback the callback to invoke | 105 * \param callback the callback to invoke |
119 * upon successful packet reception. | 106 * upon successful packet reception. |
120 */ | 107 */ |
121 void SetReceiveOkCallback (RxOkCallback callback); | 108 void SetReceiveOkCallback (WifiPhyStateHelper::RxOkCallback callback); |
122 /** | 109 /** |
123 * \param callback the callback to invoke | 110 * \param callback the callback to invoke |
124 * upon erroneous packet reception. | 111 * upon erroneous packet reception. |
125 */ | 112 */ |
126 void SetReceiveErrorCallback (RxErrorCallback callback); | 113 void SetReceiveErrorCallback (WifiPhyStateHelper::RxErrorCallback callback); |
127 | 114 |
128 /** | 115 /** |
129 * \param listener the new listener | 116 * \param listener the new listener |
130 * | 117 * |
131 * Add the input listener to the list of objects to be notified of | 118 * Add the input listener to the list of objects to be notified of |
132 * PHY-level events. | 119 * PHY-level events. |
133 */ | 120 */ |
134 void RegisterListener (WifiPhyListener *listener); | 121 void RegisterListener (WifiPhyListener *listener); |
135 /** | 122 /** |
136 * \param listener the listener to be unregistered | 123 * \param listener the listener to be unregistered |
137 * | 124 * |
138 * Remove the input listener from the list of objects to be notified of | 125 * Remove the input listener from the list of objects to be notified of |
139 * PHY-level events. | 126 * PHY-level events. |
140 */ | 127 */ |
141 void UnregisterListener (WifiPhyListener *listener); | 128 void UnregisterListener (WifiPhyListener *listener); |
| 129 |
| 130 /** |
| 131 * \param callback the callback to invoke when PHY capabilities have changed. |
| 132 */ |
| 133 void SetCapabilitiesChangedCallback (Callback<void> callback); |
142 | 134 |
143 /** | 135 /** |
144 * Starting receiving the plcp of a packet (i.e. the first bit of the preamble
has arrived). | 136 * Starting receiving the plcp of a packet (i.e. the first bit of the preamble
has arrived). |
145 * | 137 * |
146 * \param packet the arriving packet | 138 * \param packet the arriving packet |
147 * \param rxPowerW the receive power in W | 139 * \param rxPowerW the receive power in W |
148 * \param rxDuration the duration needed for the reception of the packet | 140 * \param rxDuration the duration needed for the reception of the packet |
149 */ | 141 */ |
150 void StartReceivePreambleAndHeader (Ptr<Packet> packet, | 142 void StartReceivePreambleAndHeader (Ptr<Packet> packet, |
151 double rxPowerW, | 143 double rxPowerW, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 */ | 189 */ |
198 void SetSleepMode (void); | 190 void SetSleepMode (void); |
199 /** | 191 /** |
200 * Resume from sleep mode. | 192 * Resume from sleep mode. |
201 */ | 193 */ |
202 void ResumeFromSleep (void); | 194 void ResumeFromSleep (void); |
203 /** | 195 /** |
204 * Put in off mode. | 196 * Put in off mode. |
205 */ | 197 */ |
206 void SetOffMode (void); | 198 void SetOffMode (void); |
| 199 /** |
| 200 * Resume from off mode. |
| 201 */ |
| 202 void ResumeFromOff (void); |
207 | 203 |
208 /** | 204 /** |
209 * \return true of the current state of the PHY layer is WifiPhy::IDLE, false
otherwise. | 205 * \return true of the current state of the PHY layer is WifiPhy::IDLE, false
otherwise. |
210 */ | 206 */ |
211 bool IsStateIdle (void) const; | 207 bool IsStateIdle (void) const; |
212 /** | 208 /** |
213 * \return true of the current state of the PHY layer is WifiPhy::CCA_BUSY, fa
lse otherwise. | 209 * \return true of the current state of the PHY layer is WifiPhy::CCA_BUSY, fa
lse otherwise. |
214 */ | 210 */ |
215 bool IsStateCcaBusy (void) const; | 211 bool IsStateCcaBusy (void) const; |
216 /** | 212 /** |
(...skipping 12 matching lines...) Expand all Loading... |
229 * \return true of the current state of the PHY layer is WifiPhy::SWITCHING, f
alse otherwise. | 225 * \return true of the current state of the PHY layer is WifiPhy::SWITCHING, f
alse otherwise. |
230 */ | 226 */ |
231 bool IsStateSwitching (void) const; | 227 bool IsStateSwitching (void) const; |
232 /** | 228 /** |
233 * \return true if the current state of the PHY layer is WifiPhy::SLEEP, false
otherwise. | 229 * \return true if the current state of the PHY layer is WifiPhy::SLEEP, false
otherwise. |
234 */ | 230 */ |
235 bool IsStateSleep (void) const; | 231 bool IsStateSleep (void) const; |
236 /** | 232 /** |
237 * \return true if the current state of the PHY layer is WifiPhy::OFF, false o
therwise. | 233 * \return true if the current state of the PHY layer is WifiPhy::OFF, false o
therwise. |
238 */ | 234 */ |
239 bool IsStateOff (void) const ; | 235 bool IsStateOff (void) const; |
240 | 236 |
241 /** | 237 /** |
242 * \return the amount of time since the current state has started. | 238 * \return the amount of time since the current state has started. |
243 */ | 239 */ |
244 Time GetStateDuration (void); | 240 Time GetStateDuration (void); |
245 /** | 241 /** |
246 * \return the predicted delay until this PHY can become WifiPhy::IDLE. | 242 * \return the predicted delay until this PHY can become WifiPhy::IDLE. |
247 * | 243 * |
248 * The PHY will never become WifiPhy::IDLE _before_ the delay returned by | 244 * The PHY will never become WifiPhy::IDLE _before_ the delay returned by |
249 * this method but it could become really idle later. | 245 * this method but it could become really idle later. |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 * \return the maximum available transmission power level (dBm) | 1303 * \return the maximum available transmission power level (dBm) |
1308 */ | 1304 */ |
1309 double GetTxPowerEnd (void) const; | 1305 double GetTxPowerEnd (void) const; |
1310 /** | 1306 /** |
1311 * Sets the number of transmission power levels available between the | 1307 * Sets the number of transmission power levels available between the |
1312 * minimum level and the maximum level. Transmission power levels are | 1308 * minimum level and the maximum level. Transmission power levels are |
1313 * equally separated (in dBm) with the minimum and the maximum included. | 1309 * equally separated (in dBm) with the minimum and the maximum included. |
1314 * | 1310 * |
1315 * \param n the number of available levels | 1311 * \param n the number of available levels |
1316 */ | 1312 */ |
1317 void SetNTxPower (uint32_t n); | 1313 void SetNTxPower (uint8_t n); |
1318 /** | 1314 /** |
1319 * Return the number of available transmission power levels. | 1315 * Return the number of available transmission power levels. |
1320 * | 1316 * |
1321 * \return the number of available transmission power levels | 1317 * \return the number of available transmission power levels |
1322 */ | 1318 */ |
1323 uint32_t GetNTxPower (void) const; | 1319 uint8_t GetNTxPower (void) const; |
1324 /** | 1320 /** |
1325 * Sets the transmission gain (dB). | 1321 * Sets the transmission gain (dB). |
1326 * | 1322 * |
1327 * \param gain the transmission gain in dB | 1323 * \param gain the transmission gain in dB |
1328 */ | 1324 */ |
1329 void SetTxGain (double gain); | 1325 void SetTxGain (double gain); |
1330 /** | 1326 /** |
1331 * Return the transmission gain (dB). | 1327 * Return the transmission gain (dB). |
1332 * | 1328 * |
1333 * \return the transmission gain in dB | 1329 * \return the transmission gain in dB |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 * \return the channel number if found, zero if not | 1670 * \return the channel number if found, zero if not |
1675 */ | 1671 */ |
1676 uint8_t FindChannelNumberForFrequencyWidth (uint16_t frequency, uint8_t width)
const; | 1672 uint8_t FindChannelNumberForFrequencyWidth (uint16_t frequency, uint8_t width)
const; |
1677 /** | 1673 /** |
1678 * Lookup frequency/width pair for channelNumber/standard pair | 1674 * Lookup frequency/width pair for channelNumber/standard pair |
1679 * \param channelNumber The channel number to check | 1675 * \param channelNumber The channel number to check |
1680 * \param standard The WifiPhyStandard to check | 1676 * \param standard The WifiPhyStandard to check |
1681 * \return the FrequencyWidthPair found | 1677 * \return the FrequencyWidthPair found |
1682 */ | 1678 */ |
1683 FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard (uint8_t channelN
umber, WifiPhyStandard standard) const; | 1679 FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard (uint8_t channelN
umber, WifiPhyStandard standard) const; |
1684 | 1680 |
1685 /** | 1681 /** |
1686 * Due to newly arrived signal, the current reception cannot be continued and
has to be aborted | 1682 * Due to newly arrived signal, the current reception cannot be continued and
has to be aborted |
1687 * | 1683 * |
1688 */ | 1684 */ |
1689 void AbortCurrentReception (void); | 1685 void AbortCurrentReception (void); |
1690 | 1686 |
1691 /** | 1687 /** |
1692 * Eventually switch to CCA busy | 1688 * Eventually switch to CCA busy |
1693 */ | 1689 */ |
1694 void MaybeCcaBusyDuration (void); | 1690 void MaybeCcaBusyDuration (void); |
1695 | 1691 |
1696 /** | 1692 /** |
1697 * Starting receiving the packet after having detected the medium is idle or a
fter a reception switch. | 1693 * Starting receiving the packet after having detected the medium is idle or a
fter a reception switch. |
1698 * | 1694 * |
1699 * \param packet the arriving packet | 1695 * \param packet the arriving packet |
1700 * \param txVector the TXVECTOR of the arriving packet | 1696 * \param txVector the TXVECTOR of the arriving packet |
1701 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. | 1697 * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. |
1702 * \param rxPowerW the receive power in W | 1698 * \param rxPowerW the receive power in W |
1703 * \param rxDuration the duration needed for the reception of the packet | 1699 * \param rxDuration the duration needed for the reception of the packet |
1704 * \param event the corresponding event of the first time the packet arrives | 1700 * \param event the corresponding event of the first time the packet arrives |
1705 */ | 1701 */ |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 uint16_t m_initialFrequency; //!< Store frequency until initialization | 1828 uint16_t m_initialFrequency; //!< Store frequency until initialization |
1833 bool m_frequencyChannelNumberInitialized; //!< Store initialization state | 1829 bool m_frequencyChannelNumberInitialized; //!< Store initialization state |
1834 uint8_t m_channelWidth; //!< Channel width | 1830 uint8_t m_channelWidth; //!< Channel width |
1835 | 1831 |
1836 double m_edThresholdW; //!< Energy detection threshold in watts | 1832 double m_edThresholdW; //!< Energy detection threshold in watts |
1837 double m_ccaMode1ThresholdW; //!< Clear channel assessment (CCA) threshold
in watts | 1833 double m_ccaMode1ThresholdW; //!< Clear channel assessment (CCA) threshold
in watts |
1838 double m_txGainDb; //!< Transmission gain (dB) | 1834 double m_txGainDb; //!< Transmission gain (dB) |
1839 double m_rxGainDb; //!< Reception gain (dB) | 1835 double m_rxGainDb; //!< Reception gain (dB) |
1840 double m_txPowerBaseDbm; //!< Minimum transmission power (dBm) | 1836 double m_txPowerBaseDbm; //!< Minimum transmission power (dBm) |
1841 double m_txPowerEndDbm; //!< Maximum transmission power (dBm) | 1837 double m_txPowerEndDbm; //!< Maximum transmission power (dBm) |
1842 uint32_t m_nTxPower; //!< Number of available transmission power le
vels | 1838 uint8_t m_nTxPower; //!< Number of available transmission power le
vels |
1843 | 1839 |
1844 bool m_ldpc; //!< Flag if LDPC is used | 1840 bool m_ldpc; //!< Flag if LDPC is used |
1845 bool m_stbc; //!< Flag if STBC is used | 1841 bool m_stbc; //!< Flag if STBC is used |
1846 bool m_greenfield; //!< Flag if GreenField format is supported | 1842 bool m_greenfield; //!< Flag if GreenField format is supported |
1847 bool m_shortGuardInterval; //!< Flag if HT/VHT short guard interval is
supported | 1843 bool m_shortGuardInterval; //!< Flag if HT/VHT short guard interval is
supported |
1848 bool m_shortPreamble; //!< Flag if short PLCP preamble is supporte
d | 1844 bool m_shortPreamble; //!< Flag if short PLCP preamble is supporte
d |
1849 | 1845 |
1850 Time m_guardInterval; //!< Supported HE guard interval | 1846 Time m_guardInterval; //!< Supported HE guard interval |
1851 | 1847 |
1852 uint8_t m_numberOfAntennas; //!< Number of transmitters | 1848 uint8_t m_numberOfAntennas; //!< Number of transmitters |
(...skipping 10 matching lines...) Expand all Loading... |
1863 Time m_channelSwitchDelay; //!< Time required to switch between channel | 1859 Time m_channelSwitchDelay; //!< Time required to switch between channel |
1864 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 | 1860 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 |
1865 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 | 1861 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 |
1866 | 1862 |
1867 Ptr<NetDevice> m_device; //!< Pointer to the device | 1863 Ptr<NetDevice> m_device; //!< Pointer to the device |
1868 Ptr<MobilityModel> m_mobility; //!< Pointer to the mobility model | 1864 Ptr<MobilityModel> m_mobility; //!< Pointer to the mobility model |
1869 | 1865 |
1870 Ptr<InterferenceHelper::Event> m_currentEvent; //!< Hold the current event | 1866 Ptr<InterferenceHelper::Event> m_currentEvent; //!< Hold the current event |
1871 Ptr<FrameCaptureModel> m_frameCaptureModel; //!< Frame capture model | 1867 Ptr<FrameCaptureModel> m_frameCaptureModel; //!< Frame capture model |
1872 Ptr<WifiRadioEnergyModel> m_wifiRadioEnergyModel; //!< Wifi radio energy model | 1868 Ptr<WifiRadioEnergyModel> m_wifiRadioEnergyModel; //!< Wifi radio energy model |
| 1869 |
| 1870 Callback<void> m_capabilitiesChangedCallback; //!< Callback when PHY capabilit
ies changed |
1873 }; | 1871 }; |
1874 | 1872 |
1875 /** | 1873 /** |
1876 * \param os output stream | 1874 * \param os output stream |
1877 * \param state wifi state to stringify | 1875 * \param state wifi state to stringify |
1878 * \return output stream | 1876 * \return output stream |
1879 */ | 1877 */ |
1880 std::ostream& operator<< (std::ostream& os, WifiPhyState state); | 1878 std::ostream& operator<< (std::ostream& os, WifiPhyState state); |
1881 | 1879 |
1882 } //namespace ns3 | 1880 } //namespace ns3 |
1883 | 1881 |
1884 #endif /* WIFI_PHY_H */ | 1882 #endif /* WIFI_PHY_H */ |
LEFT | RIGHT |