View | Details | Raw Unified | Return to bug 917
Collapse All | Expand All

(-)a/src/devices/wifi/mac-low.cc (-1 / +1 lines)
 Lines 1135-1141    Link Here 
1135
            ", mode=" << txMode <<
1135
            ", mode=" << txMode <<
1136
            ", duration=" << hdr->GetDuration () <<
1136
            ", duration=" << hdr->GetDuration () <<
1137
            ", seq=0x"<< std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1137
            ", seq=0x"<< std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1138
  m_phy->SendPacket (packet, txMode, WIFI_PREAMBLE_LONG, 0);
1138
  m_phy->SendPacket (packet, txMode, WIFI_PREAMBLE_LONG);
1139
}
1139
}
1140
1140
1141
void
1141
void
(-)a/src/devices/wifi/wifi-phy-test.cc (-6 / +9 lines)
 Lines 59-65    Link Here 
59
private:
59
private:
60
  void Send (void);
60
  void Send (void);
61
  void Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble);
61
  void Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble);
62
  Ptr<WifiPhy> m_tx;
62
  Ptr<YansWifiPhy> m_tx;
63
  struct Input m_input;
63
  struct Input m_input;
64
  struct Output m_output;
64
  struct Output m_output;
65
};
65
};
 Lines 69-75    Link Here 
69
{
69
{
70
  Ptr<Packet> p = Create<Packet> (m_input.packetSize);
70
  Ptr<Packet> p = Create<Packet> (m_input.packetSize);
71
  WifiMode mode = WifiMode (m_input.txMode);
71
  WifiMode mode = WifiMode (m_input.txMode);
72
  m_tx->SendPacket (p, mode, WIFI_PREAMBLE_SHORT, m_input.txPowerLevel);
72
  m_tx->SetTxPowerLevel (m_input.txPowerLevel);
73
  m_tx->SendPacket (p, mode, WIFI_PREAMBLE_SHORT);
73
}
74
}
74
75
75
void 
76
void 
 Lines 155-162    Link Here 
155
  void SendA (void) const;
156
  void SendA (void) const;
156
  void SendB (void) const;
157
  void SendB (void) const;
157
  void Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble);
158
  void Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble);
158
  Ptr<WifiPhy> m_txA;
159
  Ptr<YansWifiPhy> m_txA;
159
  Ptr<WifiPhy> m_txB;
160
  Ptr<YansWifiPhy> m_txB;
160
  uint32_t m_flowIdA;
161
  uint32_t m_flowIdA;
161
  uint32_t m_flowIdB;
162
  uint32_t m_flowIdB;
162
  struct Input m_input;
163
  struct Input m_input;
 Lines 168-175    Link Here 
168
{
169
{
169
  Ptr<Packet> p = Create<Packet> (m_input.packetSizeA);
170
  Ptr<Packet> p = Create<Packet> (m_input.packetSizeA);
170
  p->AddByteTag (FlowIdTag (m_flowIdA));
171
  p->AddByteTag (FlowIdTag (m_flowIdA));
172
  m_txA->SetTxPowerLevel (m_input.txPowerLevelA);
171
  m_txA->SendPacket (p, WifiMode (m_input.txModeA), 
173
  m_txA->SendPacket (p, WifiMode (m_input.txModeA), 
172
		     WIFI_PREAMBLE_SHORT, m_input.txPowerLevelA);
174
		     WIFI_PREAMBLE_SHORT);
173
}
175
}
174
176
175
void 
177
void 
 Lines 177-184    Link Here 
177
{
179
{
178
  Ptr<Packet> p = Create<Packet> (m_input.packetSizeB);
180
  Ptr<Packet> p = Create<Packet> (m_input.packetSizeB);
179
  p->AddByteTag (FlowIdTag (m_flowIdB));
181
  p->AddByteTag (FlowIdTag (m_flowIdB));
182
  m_txB->SetTxPowerLevel (m_input.txPowerLevelB);
180
  m_txB->SendPacket (p, WifiMode (m_input.txModeB), 
183
  m_txB->SendPacket (p, WifiMode (m_input.txModeB), 
181
		     WIFI_PREAMBLE_SHORT, m_input.txPowerLevelB);
184
		     WIFI_PREAMBLE_SHORT);
182
}
185
}
183
186
184
void 
187
void 
(-)a/src/devices/wifi/wifi-phy.h (-3 / +6 lines)
 Lines 167-172    Link Here 
167
  virtual uint32_t GetNTxPower (void) const = 0;
167
  virtual uint32_t GetNTxPower (void) const = 0;
168
168
169
  /**
169
  /**
170
   * \returns the tx power level.
171
   */
172
  virtual uint32_t GetTxPowerLevel (void) const = 0;
173
174
  /**
170
   * \param callback the callback to invoke
175
   * \param callback the callback to invoke
171
   *        upon successful packet reception.
176
   *        upon successful packet reception.
172
   */
177
   */
 Lines 181-190    Link Here 
181
   * \param packet the packet to send
186
   * \param packet the packet to send
182
   * \param mode the transmission mode to use to send this packet
187
   * \param mode the transmission mode to use to send this packet
183
   * \param preamble the type of preamble to use to send this packet.
188
   * \param preamble the type of preamble to use to send this packet.
184
   * \param txPowerLevel a power level to use to send this packet. The real
185
   *        transmission power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
186
   */
189
   */
187
  virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel) = 0;
190
  virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble) = 0;
188
191
189
  /**
192
  /**
190
   * \param listener the new listener
193
   * \param listener the new listener
(-)a/src/devices/wifi/yans-wifi-phy.cc (-4 / +22 lines)
 Lines 81-86    Link Here 
81
                   UintegerValue (1),
81
                   UintegerValue (1),
82
                   MakeUintegerAccessor (&YansWifiPhy::m_nTxPower),
82
                   MakeUintegerAccessor (&YansWifiPhy::m_nTxPower),
83
                   MakeUintegerChecker<uint32_t> ())
83
                   MakeUintegerChecker<uint32_t> ())
84
    .AddAttribute ("TxPowerLevel",
85
                   "Transmission power level to be used.",
86
                   UintegerValue (0),
87
                   MakeUintegerAccessor (&YansWifiPhy::SetTxPowerLevel,
88
                                         &YansWifiPhy::GetTxPowerLevel),
89
                   MakeUintegerChecker<uint32_t> ())
84
    .AddAttribute ("TxPowerEnd",
90
    .AddAttribute ("TxPowerEnd",
85
                   "Maximum available transmission level (dbm).",
91
                   "Maximum available transmission level (dbm).",
86
                   DoubleValue (16.0206),
92
                   DoubleValue (16.0206),
 Lines 208-213    Link Here 
208
  NS_LOG_FUNCTION (this << n);
214
  NS_LOG_FUNCTION (this << n);
209
  m_nTxPower = n;
215
  m_nTxPower = n;
210
}
216
}
217
void
218
YansWifiPhy::SetTxPowerLevel (uint32_t n)
219
{
220
  NS_ASSERT (n < GetNTxPower ());
221
  NS_LOG_FUNCTION (this << n);
222
  m_txPowerLevel = n;
223
}
211
void 
224
void 
212
YansWifiPhy::SetTxGain (double gain)
225
YansWifiPhy::SetTxGain (double gain)
213
{
226
{
 Lines 489-497    Link Here 
489
}
502
}
490
503
491
void 
504
void 
492
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower)
505
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiMode txMode, WifiPreamble preamble)
493
{
506
{
494
  NS_LOG_FUNCTION (this << packet << txMode << preamble << (uint32_t)txPower);
507
  NS_LOG_FUNCTION (this << packet << txMode << preamble);
495
  /* Transmission can happen if:
508
  /* Transmission can happen if:
496
   *  - we are syncing on a packet. It is the responsability of the
509
   *  - we are syncing on a packet. It is the responsability of the
497
   *    MAC layer to avoid doing this but the PHY does nothing to 
510
   *    MAC layer to avoid doing this but the PHY does nothing to 
 Lines 509-516    Link Here 
509
  uint32_t dataRate500KbpsUnits = txMode.GetDataRate () / 500000;   
522
  uint32_t dataRate500KbpsUnits = txMode.GetDataRate () / 500000;   
510
  bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
523
  bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
511
  NotifyPromiscSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble);
524
  NotifyPromiscSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble);
512
  m_state->SwitchToTx (txDuration, packet, txMode, preamble, txPower);
525
  m_state->SwitchToTx (txDuration, packet, txMode, preamble, m_txPowerLevel);
513
  m_channel->Send (this, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble);
526
  m_channel->Send (this, packet, GetPowerDbm (m_txPowerLevel) + m_txGainDb, txMode, preamble);
514
}
527
}
515
528
516
uint32_t 
529
uint32_t 
 Lines 528-533    Link Here 
528
{
541
{
529
  return m_nTxPower;
542
  return m_nTxPower;
530
}
543
}
544
uint32_t
545
YansWifiPhy::GetTxPowerLevel (void) const
546
{
547
  return m_txPowerLevel;
548
}
531
549
532
void
550
void
533
YansWifiPhy::Configure80211a (void)
551
YansWifiPhy::Configure80211a (void)
(-)a/src/devices/wifi/yans-wifi-phy.h (-1 / +4 lines)
 Lines 100-105    Link Here 
100
  void SetTxPowerStart (double start);
100
  void SetTxPowerStart (double start);
101
  void SetTxPowerEnd (double end);
101
  void SetTxPowerEnd (double end);
102
  void SetNTxPower (uint32_t n);
102
  void SetNTxPower (uint32_t n);
103
  void SetTxPowerLevel (uint32_t n);
103
  void SetTxGain (double gain);
104
  void SetTxGain (double gain);
104
  void SetRxGain (double gain);
105
  void SetRxGain (double gain);
105
  void SetEdThreshold (double threshold);
106
  void SetEdThreshold (double threshold);
 Lines 122-130    Link Here 
122
  virtual double GetTxPowerStart (void) const;
123
  virtual double GetTxPowerStart (void) const;
123
  virtual double GetTxPowerEnd (void) const;
124
  virtual double GetTxPowerEnd (void) const;
124
  virtual uint32_t GetNTxPower (void) const;
125
  virtual uint32_t GetNTxPower (void) const;
126
  virtual uint32_t GetTxPowerLevel (void) const;
125
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
127
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
126
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
128
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
127
  virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel);
129
  virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble);
128
  virtual void RegisterListener (WifiPhyListener *listener);
130
  virtual void RegisterListener (WifiPhyListener *listener);
129
  virtual bool IsStateCcaBusy (void);
131
  virtual bool IsStateCcaBusy (void);
130
  virtual bool IsStateIdle (void);
132
  virtual bool IsStateIdle (void);
 Lines 168-173    Link Here 
168
  double   m_txPowerBaseDbm;
170
  double   m_txPowerBaseDbm;
169
  double   m_txPowerEndDbm;
171
  double   m_txPowerEndDbm;
170
  uint32_t m_nTxPower;
172
  uint32_t m_nTxPower;
173
  uint32_t m_txPowerLevel;
171
174
172
  Ptr<YansWifiChannel> m_channel;
175
  Ptr<YansWifiChannel> m_channel;
173
  uint16_t m_channelNumber;
176
  uint16_t m_channelNumber;

Return to bug 917