ChannelId -> ChannelNumber and also in the base class WifiPhy
authorPavel Boyko <boyko@iitp.ru>
Tue, 14 Jul 2009 09:43:58 +0400
changeset 5118 3a0893ec9819
parent 5105 7f4bd2584e9d
child 5119 854f1900afd1
ChannelId -> ChannelNumber and also in the base class WifiPhy
src/devices/mesh/mesh-wifi-interface-mac.cc
src/devices/wifi/wifi-phy.h
src/devices/wifi/yans-wifi-channel.cc
src/devices/wifi/yans-wifi-phy.cc
src/devices/wifi/yans-wifi-phy.h
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc	Sun Jul 05 12:28:45 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc	Tue Jul 14 09:43:58 2009 +0400
@@ -337,7 +337,7 @@
 
   Ptr<YansWifiPhy> phy = m_phy->GetObject<YansWifiPhy> ();
   if (phy != 0)
-    return phy->GetFrequencyChannel ();
+    return phy->GetChannelNumber ();
   else
     return 0;
 }
@@ -360,7 +360,7 @@
   NS_ASSERT(CanSwitchChannel());
 
   Ptr<YansWifiPhy> phy = m_phy->GetObject<YansWifiPhy> ();
-  phy->SetFrequencyChannel (new_id);
+  phy->SetChannelNumber (new_id);
   // Don't know NAV on new channel
   m_dcfManager->NotifyNavResetNow (Seconds (0));
 }
--- a/src/devices/wifi/wifi-phy.h	Sun Jul 05 12:28:45 2009 +0400
+++ b/src/devices/wifi/wifi-phy.h	Tue Jul 14 09:43:58 2009 +0400
@@ -241,7 +241,19 @@
    *          the requested ber for the specified transmission mode. (W/W)
    */
   virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
-
+  
+  /** 
+   * \brief Set channel number. 
+   * 
+   * Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
+   *
+   * where Starting channel frequency is standard-dependent, see SetStandard()
+   * as defined in IEEE 802.11-2007 17.3.8.3.2.
+   */ 
+  virtual void SetChannelNumber (uint16_t id) = 0;
+  /// Return current channel number, see SetChannelNumber()
+  virtual uint16_t GetChannelNumber () const = 0;
+  
   virtual Ptr<WifiChannel> GetChannel (void) const = 0;
 
   static WifiMode Get6mba (void);
--- a/src/devices/wifi/yans-wifi-channel.cc	Sun Jul 05 12:28:45 2009 +0400
+++ b/src/devices/wifi/yans-wifi-channel.cc	Tue Jul 14 09:43:58 2009 +0400
@@ -82,7 +82,7 @@
       if (sender != (*i))
         {
           // For now don't account for inter channel interference
-          if ((*i)->GetFrequencyChannel() != sender->GetFrequencyChannel())
+          if ((*i)->GetChannelNumber() != sender->GetChannelNumber())
               continue;
           
           Ptr<MobilityModel> receiverMobility = (*i)->GetMobility ()->GetObject<MobilityModel> ();
--- a/src/devices/wifi/yans-wifi-phy.cc	Sun Jul 05 12:28:45 2009 +0400
+++ b/src/devices/wifi/yans-wifi-phy.cc	Tue Jul 14 09:43:58 2009 +0400
@@ -308,28 +308,28 @@
 }
 
 void 
-YansWifiPhy::SetFrequencyChannel (uint16_t nch)
+YansWifiPhy::SetChannelNumber (uint16_t nch)
 {
-  Simulator::Schedule (m_channelSwitchDelay, &YansWifiPhy::DoSetChannelId, this, nch);
+  Simulator::Schedule (m_channelSwitchDelay, &YansWifiPhy::DoSetChannelNumber, this, nch);
 }
 
 void
-YansWifiPhy::DoSetChannelId (uint16_t nch)
+YansWifiPhy::DoSetChannelNumber (uint16_t nch)
 {
   NS_LOG_DEBUG("switching channel " << m_channelId << " -> " << nch);
   m_channelId = nch;
 }
 
 uint16_t 
-YansWifiPhy::GetFrequencyChannel() const
+YansWifiPhy::GetChannelNumber() const
 {
   return m_channelId;
 }
 
 double
-YansWifiPhy::GetCenterFrequencyMhz() const
+YansWifiPhy::GetChannelFrequencyMhz() const
 {
-  return m_channelStartingFrequency + 5 * (GetFrequencyChannel() - 1);
+  return m_channelStartingFrequency + 5 * (GetChannelNumber() - 1);
 }
 
 void 
@@ -443,7 +443,7 @@
   NotifyTxBegin (packet);
   uint32_t dataRate500KbpsUnits = txMode.GetDataRate () / 500000;   
   bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
-  NotifyPromiscSniffTx (packet, (uint16_t)GetCenterFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble);
+  NotifyPromiscSniffTx (packet, (uint16_t)GetChannelFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble);
   m_state->SwitchToTx (txDuration, packet, txMode, preamble, txPower);
   m_channel->Send (this, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble);
 }
@@ -622,7 +622,7 @@
       bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());  
       double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
       double noiseDbm = RatioToDb(event->GetRxPowerW() / snrPer.snr) - GetRxNoiseFigure() + 30 ;
-      NotifyPromiscSniffRx (packet, (uint16_t)GetCenterFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
+      NotifyPromiscSniffRx (packet, (uint16_t)GetChannelFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
       m_state->SwitchFromSyncEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
     } 
   else 
--- a/src/devices/wifi/yans-wifi-phy.h	Sun Jul 05 12:28:45 2009 +0400
+++ b/src/devices/wifi/yans-wifi-phy.h	Tue Jul 14 09:43:58 2009 +0400
@@ -78,11 +78,11 @@
    * where Starting channel frequency is standard-dependent, see SetStandard()
    * as defined in IEEE 802.11-2007 17.3.8.3.2.
    */ 
-  void SetFrequencyChannel (uint16_t id);
-  /// Return current channel ID, see SetChannelId()
-  uint16_t GetFrequencyChannel () const;
-  /// Return current center channel frequency in MHz, see SetFrequencyChannel()
-  double GetCenterFrequencyMhz() const;
+  void SetChannelNumber (uint16_t id);
+  /// Return current channel number, see SetChannelNumber()
+  uint16_t GetChannelNumber () const;
+  /// Return current center channel frequency in MHz, see SetСhannelNumber()
+  double GetChannelFrequencyMhz() const;
   
   void StartReceivePacket (Ptr<Packet> packet,
                            double rxPowerDbm,
@@ -150,7 +150,7 @@
   double RatioToDb (double ratio) const;
   double GetPowerDbm (uint8_t power) const;
   void EndSync (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event);
-  void DoSetChannelId(uint16_t id);
+  void DoSetChannelNumber(uint16_t id);
 
 private:
   double   m_edThresholdW;