src/wifi/model/mac-low.cc
changeset 10883 d919e7194e23
parent 10483 e3a02ed14587
child 10968 2d29fee2b7b8
--- a/src/wifi/model/mac-low.cc	Fri Sep 05 15:38:55 2014 -0700
+++ b/src/wifi/model/mac-low.cc	Fri Sep 05 16:33:57 2014 -0700
@@ -270,7 +270,7 @@
   virtual void NotifyRxEndError (void)
   {
   }
-  virtual void NotifyTxStart (Time duration)
+  virtual void NotifyTxStart (Time duration, double txPowerDbm)
   {
   }
   virtual void NotifyMaybeCcaBusyStart (Time duration)
@@ -280,6 +280,13 @@
   {
     m_macLow->NotifySwitchingStartNow (duration);
   }
+  virtual void NotifySleep (void)
+  {
+    m_macLow->NotifySleepNow ();
+  }
+  virtual void NotifyWakeup (void)
+  {
+  }
 private:
   ns3::MacLow *m_macLow;
 };
@@ -653,6 +660,22 @@
 }
 
 void
+MacLow::NotifySleepNow (void)
+{
+  NS_LOG_DEBUG ("Device in sleep mode. Cancelling MAC pending events");
+  m_stationManager->Reset ();
+  CancelAllEvents ();
+  if (m_navCounterResetCtsMissed.IsRunning ())
+    {
+      m_navCounterResetCtsMissed.Cancel ();
+    }
+  m_lastNavStart = Simulator::Now ();
+  m_lastNavDuration = Seconds (0);
+  m_currentPacket = 0;
+  m_listener = 0;
+}
+
+void
 MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamble preamble)
 {
   NS_LOG_FUNCTION (this << packet << rxSnr << txMode << preamble);
@@ -1249,7 +1272,7 @@
                 ", mode=" << txVector.GetMode() <<
                 ", duration=" << hdr->GetDuration () <<
                 ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
-  m_phy->SendPacket (packet, txVector.GetMode(), preamble, txVector);
+  m_phy->SendPacket (packet, txVector, preamble);
 }
 
 void