src/wifi/model/mac-low.cc
changeset 11159 b744c32b69bc
parent 11083 96e983e7cd5d
child 11174 780a43e4980c
--- a/src/wifi/model/mac-low.cc	Mon Jan 26 23:21:27 2015 +0100
+++ b/src/wifi/model/mac-low.cc	Mon Jan 26 15:17:35 2015 -0800
@@ -327,6 +327,16 @@
   phy->RegisterListener (m_phyMacLowListener);
 }
 
+void
+MacLow::RemovePhyMacLowListener (Ptr<WifiPhy> phy)
+{
+  if (m_phyMacLowListener != 0 )
+    {
+      phy->UnregisterListener (m_phyMacLowListener);
+      delete m_phyMacLowListener;
+      m_phyMacLowListener = 0;
+    }
+}
 
 void
 MacLow::DoDispose (void)
@@ -433,6 +443,19 @@
   m_phy->SetReceiveErrorCallback (MakeCallback (&MacLow::ReceiveError, this));
   SetupPhyMacLowListener (phy);
 }
+Ptr<WifiPhy>
+MacLow::GetPhy (void) const
+{
+  return m_phy;
+}
+void
+MacLow::ResetPhy (void)
+{
+  m_phy->SetReceiveOkCallback (MakeNullCallback<void,Ptr<Packet>, double, WifiMode, enum WifiPreamble>  ());
+  m_phy->SetReceiveErrorCallback (MakeNullCallback<void,Ptr<const Packet>, double> ());
+  RemovePhyMacLowListener (m_phy);
+  m_phy = 0;
+}
 void
 MacLow::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> manager)
 {
@@ -663,7 +686,6 @@
 MacLow::NotifySleepNow (void)
 {
   NS_LOG_DEBUG ("Device in sleep mode. Cancelling MAC pending events");
-  m_stationManager->Reset ();
   CancelAllEvents ();
   if (m_navCounterResetCtsMissed.IsRunning ())
     {