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

(-)a/src/wifi/model/yans-wifi-phy.cc (-10 / +31 lines)
 Lines 452-458    Link Here 
452
  rxPowerDbm += m_rxGainDb;
452
  rxPowerDbm += m_rxGainDb;
453
  double rxPowerW = DbmToW (rxPowerDbm);
453
  double rxPowerW = DbmToW (rxPowerDbm);
454
  Time rxDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble);
454
  Time rxDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble);
455
WifiMode txMode=txVector.GetMode();
455
  WifiMode txMode = txVector.GetMode();
456
  Time endRx = Simulator::Now () + rxDuration;
456
  Time endRx = Simulator::Now () + rxDuration;
457
457
458
  Ptr<InterferenceHelper::Event> event;
458
  Ptr<InterferenceHelper::Event> event;
 Lines 509-523    Link Here 
509
    case YansWifiPhy::IDLE:
509
    case YansWifiPhy::IDLE:
510
      if (rxPowerW > m_edThresholdW)
510
      if (rxPowerW > m_edThresholdW)
511
        {
511
        {
512
          NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
512
          if (IsModeSupported (txMode))
513
          // sync to signal
513
            {
514
          m_state->SwitchToRx (rxDuration);
514
              NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
515
          NS_ASSERT (m_endRxEvent.IsExpired ());
515
              // sync to signal
516
          NotifyRxBegin (packet);
516
              m_state->SwitchToRx (rxDuration);
517
          m_interference.NotifyRxStart ();
517
              NS_ASSERT (m_endRxEvent.IsExpired ());
518
          m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
518
              NotifyRxBegin (packet);
519
                                              packet,
519
              m_interference.NotifyRxStart ();
520
                                              event);
520
              m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
521
                                                  packet,
522
                                                  event);
523
            }
524
          else
525
            {
526
              NS_LOG_DEBUG ("drop packet because it was sent using an unsupported mode (" << txMode << ")");
527
              NotifyRxDrop (packet);
528
              goto maybeCcaBusy;
529
            }
521
        }
530
        }
522
      else
531
      else
523
        {
532
        {
 Lines 580-585    Link Here 
580
{
589
{
581
  return m_deviceRateSet[mode];
590
  return m_deviceRateSet[mode];
582
}
591
}
592
bool
593
YansWifiPhy::IsModeSupported (WifiMode mode) const
594
{
595
  for (uint32_t i = 0; i < GetNModes (); i++)
596
    {
597
      if (mode == GetMode (i))
598
        {
599
          return true;
600
        }
601
    }
602
  return false;
603
}
583
uint32_t
604
uint32_t
584
YansWifiPhy::GetNTxPower (void) const
605
YansWifiPhy::GetNTxPower (void) const
585
{
606
{
(-)a/src/wifi/model/yans-wifi-phy.h (+1 lines)
 Lines 260-265    Link Here 
260
  virtual Time GetLastRxStartTime (void) const;
260
  virtual Time GetLastRxStartTime (void) const;
261
  virtual uint32_t GetNModes (void) const;
261
  virtual uint32_t GetNModes (void) const;
262
  virtual WifiMode GetMode (uint32_t mode) const;
262
  virtual WifiMode GetMode (uint32_t mode) const;
263
  virtual bool IsModeSupported (WifiMode mode) const;
263
  virtual double CalculateSnr (WifiMode txMode, double ber) const;
264
  virtual double CalculateSnr (WifiMode txMode, double ber) const;
264
  virtual Ptr<WifiChannel> GetChannel (void) const;
265
  virtual Ptr<WifiChannel> GetChannel (void) const;
265
  
266
  

Return to bug 1848