PowerSaveManager is an abstract base class. More...
#include "power-save-manager.h"
Classes | |
| struct | StaInfo |
| Information about each STA operating on a given link. More... | |
Public Member Functions | |
| ~PowerSaveManager () override | |
| uint32_t | GetListenInterval () const |
| std::optional< Time > | GetTimeUntilNextTbtt (linkId_t linkId) const |
| void | NotifyAssocCompleted () |
| Notify that the non-AP STA/MLD has completed association with an AP. | |
| void | NotifyBeaconIntervalAndTimestamp (const Time &beaconInterval, const Time ×tamp, linkId_t linkId) |
| This function is normally used to notify the Beacon interval and timestamp included in the last Beacon frame advertised by the AP this device is going to associate with. | |
| void | NotifyChannelReleased (Ptr< Txop > txop, linkId_t linkId) |
| Notify that the given TXOP has released the channel on the given link. | |
| void | NotifyDisassociation () |
| Notify that the non-AP STA/MLD has disassociated. | |
| void | NotifyPmModeChanged (WifiPowerManagementMode pmMode, linkId_t linkId) |
| Notify that the Power Management mode of the non-AP STA operating on the given link has changed. | |
| void | NotifyReceivedBeacon (Ptr< const WifiMpdu > mpdu, linkId_t linkId) |
| Notify that a Beacon frame has been received from the associated AP on the given link. | |
| void | NotifyReceivedFrameAfterPsPoll (Ptr< const WifiMpdu > mpdu, linkId_t linkId) |
| Notify the reception of a frame in response to a PS-Poll frame on the given link. | |
| void | NotifyReceivedGroupcast (Ptr< const WifiMpdu > mpdu, linkId_t linkId) |
| Notify the reception of a groupcast frame (possibly after a DTIM) on the given link. | |
| void | NotifyRequestAccess (Ptr< Txop > txop, linkId_t linkId) |
| Notify that the given TXOP is requesting channel access on the given link. | |
| void | SetPowerSaveMode (const std::map< linkId_t, bool > &linkIdEnableMap) |
| Enable or disable Power Save mode on a given set of links. | |
| void | SetWifiMac (Ptr< StaWifiMac > mac) |
| Set the MAC which is using this Power Save Manager. | |
| void | TxDropped (WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu) |
| Notify that the given MPDU has been discarded for the given reason. | |
| Public Member Functions inherited from ns3::Object | |
| Object () | |
| Caller graph was not generated because of its size. | |
| ~Object () override | |
| Destructor. | |
| void | AggregateObject (Ptr< Object > other) |
| Aggregate two Objects together. | |
| void | Dispose () |
| Dispose of this Object. | |
| AggregateIterator | GetAggregateIterator () const |
| Get an iterator to the Objects aggregated to this one. | |
| TypeId | GetInstanceTypeId () const final |
| Get the most derived TypeId for this Object. | |
| template<> | |
| Ptr< Object > | GetObject () const |
| Specialization of () for objects of type ns3::Object. | |
| template<typename T> | |
| Ptr< T > | GetObject () const |
| Get a pointer to the requested aggregated Object. | |
| template<> | |
| Ptr< Object > | GetObject (TypeId tid) const |
| Specialization of (TypeId tid) for objects of type ns3::Object. | |
| template<typename T> | |
| Ptr< T > | GetObject (TypeId tid) const |
| Get a pointer to the requested aggregated Object by TypeId. | |
| void | Initialize () |
| Invoke DoInitialize on all Objects aggregated to this one. | |
| bool | IsInitialized () const |
| Check if the object has been initialized. | |
| void | UnidirectionalAggregateObject (Ptr< Object > other) |
| Aggregate an Object to another Object. | |
| Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
| SimpleRefCount () | |
| Default constructor. | |
| uint32_t | GetReferenceCount () const |
| Get the reference count of the object. | |
| SimpleRefCount & | operator= (const SimpleRefCount &o) |
| Assignment operator. | |
| void | Ref () const |
| Increment the reference count. | |
| void | Unref () const |
| Decrement the reference count. | |
| Public Member Functions inherited from ns3::ObjectBase | |
| virtual | ~ObjectBase () |
| Virtual destructor. | |
| void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
| Get the value of an attribute, raising fatal errors if unsuccessful. | |
| bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
| Get the value of an attribute without raising errors. | |
| void | SetAttribute (std::string name, const AttributeValue &value) |
| Set a single attribute, raising fatal errors if unsuccessful. | |
| bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
| Set a single attribute without raising errors. | |
| bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
| Connect a TraceSource to a Callback with a context. | |
| bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
| Connect a TraceSource to a Callback without a context. | |
| bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
| Disconnect from a TraceSource a Callback previously connected with a context. | |
| bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
| Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
| static TypeId | GetTypeId () |
| Get the type ID. | |
| Static Public Member Functions inherited from ns3::Object | |
| static TypeId | GetTypeId () |
| Register this type. | |
| Static Public Member Functions inherited from ns3::ObjectBase | |
| static TypeId | GetTypeId () |
| Get the type ID. | |
Protected Member Functions | |
| void | DoDispose () override |
| Destructor implementation. | |
| void | DoInitialize () override |
| Initialize() implementation. | |
| virtual void | DoNotifyAssocCompleted ()=0 |
| Notify subclasses that the non-AP STA/MLD has completed association with an AP. | |
| virtual void | DoNotifyChannelReleased (Ptr< Txop > txop, linkId_t linkId)=0 |
| Notify subclasses that the given TXOP is releasing the channel on the given link. | |
| virtual void | DoNotifyDisassociation ()=0 |
| Notify subclasses that the non-AP STA/MLD has disassociated. | |
| virtual void | DoNotifyPmModeChanged (WifiPowerManagementMode pmMode, linkId_t linkId)=0 |
| Notify subclasses that the Power Management mode of the non-AP STA operating on the given link has changed. | |
| virtual void | DoNotifyReceivedBeacon (const MgtBeaconHeader &beacon, linkId_t linkId)=0 |
| Notify subclasses that a Beacon frame has been received from the associated AP on the given link. | |
| virtual void | DoNotifyReceivedFrameAfterPsPoll (Ptr< const WifiMpdu > mpdu, linkId_t linkId)=0 |
| Notify subclasses of the reception of a frame in response to a PS-Poll frame on the given link. | |
| virtual void | DoNotifyReceivedGroupcast (Ptr< const WifiMpdu > mpdu, linkId_t linkId)=0 |
| Notify subclasses of the reception of a groupcast frame (possibly after a DTIM) on the given link. | |
| virtual void | DoNotifyRequestAccess (Ptr< Txop > txop, linkId_t linkId)=0 |
| Notify subclasses that the given TXOP is requesting channel access on the given link. | |
| virtual void | DoTxDropped (WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu)=0 |
| Notify subclasses that the given MPDU has been discarded for the given reason. | |
| StaInfo & | GetStaInfo (linkId_t linkId) |
| Get the information about the STA operating on the given link. | |
| Ptr< StaWifiMac > | GetStaMac () const |
| bool | HasRequestedOrGainedChannel (linkId_t linkId) const |
| Get whether any Access Category has requested (or gained) the channel on the given link. | |
| Protected Member Functions inherited from ns3::Object | |
| Object (const Object &o) | |
| Copy an Object. | |
| virtual void | NotifyNewAggregate () |
| Notify all Objects aggregated to this one of a new Object being aggregated. | |
| Protected Member Functions inherited from ns3::ObjectBase | |
| void | ConstructSelf (const AttributeConstructionList &attributes) |
| Complete construction of ObjectBase; invoked by derived classes. | |
| virtual void | NotifyConstructionCompleted () |
| Notifier called once the ObjectBase is fully constructed. | |
Private Types | |
| using | PmModeChangeCallback = void (*)(linkId_t, WifiPowerManagementMode) |
| TracedCallback signature for power management mode change events. | |
Private Attributes | |
| std::map< linkId_t, bool > | m_linkIdEnableMap |
| a link ID-indexed map indicating whether to enable or not power save mode on the link with the given ID (used before initialization) | |
| uint32_t | m_listenInterval |
| beacon listen interval | |
| TracedCallback< linkId_t, WifiPowerManagementMode > | m_pmModeLogger |
| link ID-indexed power management mode logger | |
| std::map< linkId_t, StaInfo > | m_staInfo |
| link ID-indexed map of STA infos | |
| Ptr< StaWifiMac > | m_staMac |
| MAC which is using this Power Save Manager. | |
Additional Inherited Members | |
| Related Symbols inherited from ns3::ObjectBase | |
| static TypeId | GetObjectIid () |
| Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
PowerSaveManager is an abstract base class.
Each subclass defines a logic to switch a STA in powersave mode between active state and doze state.
ns3::PowerSaveManager is accessible through the following paths with Config::Set and Config::Connect:
ns3::Ptr<N3ns39PairValueINS_13UintegerValueENS_12BooleanValueEEE> Group: Wifi
Size of this type is 192 bytes (on a 64-bit architecture).
Definition at line 38 of file power-save-manager.h.
|
private |
TracedCallback signature for power management mode change events.
Definition at line 274 of file power-save-manager.h.
|
override |
Definition at line 68 of file power-save-manager.cc.
References NS_LOG_FUNCTION_NOARGS.
|
overrideprotectedvirtual |
Destructor implementation.
This method is called by Dispose() or by the Object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.
It is safe to call GetObject() from within this method.
Caller graph was not generated because of its size.
Reimplemented from ns3::Object.
Definition at line 86 of file power-save-manager.cc.
References ns3::Object::DoDispose(), m_staMac, ns3::MakeCallback(), NS_LOG_FUNCTION, and TxDropped().
|
overrideprotectedvirtual |
Initialize() implementation.
This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.
Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 74 of file power-save-manager.cc.
References m_linkIdEnableMap, m_staMac, and NS_LOG_FUNCTION.
|
protectedpure virtual |
Notify subclasses that the non-AP STA/MLD has completed association with an AP.
Implemented in ns3::DefaultPowerSaveManager.
Referenced by NotifyAssocCompleted().
|
protectedpure virtual |
Notify subclasses that the given TXOP is releasing the channel on the given link.
| txop | the DCF/EDCAF releasing the channel |
| linkId | the ID of the given link |
Implemented in ns3::DefaultPowerSaveManager.
Referenced by NotifyChannelReleased().
|
protectedpure virtual |
Notify subclasses that the non-AP STA/MLD has disassociated.
Implemented in ns3::DefaultPowerSaveManager.
Referenced by NotifyDisassociation().
|
protectedpure virtual |
Notify subclasses that the Power Management mode of the non-AP STA operating on the given link has changed.
| pmMode | the new PM mode |
| linkId | the ID of the given link |
Implemented in ns3::DefaultPowerSaveManager.
Referenced by NotifyPmModeChanged().
|
protectedpure virtual |
Notify subclasses that a Beacon frame has been received from the associated AP on the given link.
| beacon | the Beacon frame |
| linkId | the ID of the given link |
Implemented in ns3::DefaultPowerSaveManager.
Referenced by NotifyReceivedBeacon().
|
protectedpure virtual |
Notify subclasses of the reception of a frame in response to a PS-Poll frame on the given link.
The notification is sent a SIFS after the reception of the frame.
| mpdu | the received MPDU |
| linkId | the ID of the given link |
Implemented in ns3::DefaultPowerSaveManager.
Referenced by NotifyReceivedFrameAfterPsPoll().
|
protectedpure virtual |
Notify subclasses of the reception of a groupcast frame (possibly after a DTIM) on the given link.
| mpdu | the received MPDU |
| linkId | the ID of the given link |
Implemented in ns3::DefaultPowerSaveManager.
Referenced by NotifyReceivedGroupcast().
|
protectedpure virtual |
Notify subclasses that the given TXOP is requesting channel access on the given link.
| txop | the DCF/EDCAF requesting channel access |
| linkId | the ID of the given link |
Implemented in ns3::DefaultPowerSaveManager.
Referenced by NotifyRequestAccess().
|
protectedpure virtual |
Notify subclasses that the given MPDU has been discarded for the given reason.
| reason | the reason why the MPDU was dropped |
| mpdu | the dropped MPDU |
Implemented in ns3::DefaultPowerSaveManager.
Referenced by TxDropped().
| uint32_t ns3::PowerSaveManager::GetListenInterval | ( | ) | const |
Definition at line 111 of file power-save-manager.cc.
References m_listenInterval.
Referenced by ns3::DefaultPowerSaveManager::GoToSleepIfPossible().
|
protected |
Get the information about the STA operating on the given link.
| linkId | the ID of the given link |
Definition at line 117 of file power-save-manager.cc.
References m_staInfo, and NS_ASSERT.
Referenced by ns3::DefaultPowerSaveManager::DoNotifyReceivedBeacon(), ns3::DefaultPowerSaveManager::DoNotifyReceivedFrameAfterPsPoll(), ns3::DefaultPowerSaveManager::DoTxDropped(), ns3::DefaultPowerSaveManager::GoToSleepIfPossible(), NotifyReceivedBeacon(), NotifyReceivedFrameAfterPsPoll(), and NotifyReceivedGroupcast().
|
protected |
Definition at line 105 of file power-save-manager.cc.
References m_staMac.
Referenced by ns3::DefaultPowerSaveManager::DoNotifyAssocCompleted(), ns3::DefaultPowerSaveManager::DoNotifyReceivedBeacon(), ns3::DefaultPowerSaveManager::DoNotifyReceivedFrameAfterPsPoll(), ns3::DefaultPowerSaveManager::DoNotifyRequestAccess(), ns3::DefaultPowerSaveManager::DoTxDropped(), ns3::DefaultPowerSaveManager::GoToSleepIfPossible(), HasRequestedOrGainedChannel(), NotifyReceivedFrameAfterPsPoll(), NotifyReceivedGroupcast(), and TxDropped().
| linkId | the ID of the given link |
Definition at line 166 of file power-save-manager.cc.
References m_staInfo, and ns3::Simulator::Now().
|
static |
Get the type ID.
Definition at line 32 of file power-save-manager.cc.
References ns3::Object::Object(), m_listenInterval, m_pmModeLogger, ns3::MakeAttributeContainerAccessor(), ns3::MakeAttributeContainerChecker(), ns3::MakeBooleanChecker(), ns3::MakePairChecker(), ns3::MakeTraceSourceAccessor(), ns3::MakeUintegerAccessor(), ns3::MakeUintegerChecker(), ns3::TypeId::SetParent(), and SetPowerSaveMode().
|
protected |
Get whether any Access Category has requested (or gained) the channel on the given link.
| linkId | the ID of the given link |
Definition at line 124 of file power-save-manager.cc.
References ns3::AC_BE_NQOS, ns3::edcaAcIndices, GetStaMac(), ns3::Txop::GRANTED, and ns3::Txop::REQUESTED.
Referenced by ns3::DefaultPowerSaveManager::GoToSleepIfPossible().
| void ns3::PowerSaveManager::NotifyAssocCompleted | ( | ) |
Notify that the non-AP STA/MLD has completed association with an AP.
Definition at line 182 of file power-save-manager.cc.
References DoNotifyAssocCompleted(), m_staInfo, m_staMac, and NS_LOG_FUNCTION.
Referenced by ns3::StaWifiMac::SetPmModeAfterAssociation().
| void ns3::PowerSaveManager::NotifyBeaconIntervalAndTimestamp | ( | const Time & | beaconInterval, |
| const Time & | timestamp, | ||
| linkId_t | linkId ) |
This function is normally used to notify the Beacon interval and timestamp included in the last Beacon frame advertised by the AP this device is going to associate with.
The purpose is to be able to put the PHY operating on the given link to sleep (if needed) right after association is completed.
| beaconInterval | the Beacon interval |
| timestamp | the timestamp included in the Beacon frame |
| linkId | the ID of the link on which the Beacon frame was sent |
Definition at line 157 of file power-save-manager.cc.
References m_staInfo, and NS_LOG_FUNCTION.
Notify that the given TXOP has released the channel on the given link.
| txop | the DCF/EDCAF releasing the channel |
| linkId | the ID of the given link |
Definition at line 313 of file power-save-manager.cc.
References DoNotifyChannelReleased(), and NS_LOG_FUNCTION.
| void ns3::PowerSaveManager::NotifyDisassociation | ( | ) |
Notify that the non-AP STA/MLD has disassociated.
Definition at line 196 of file power-save-manager.cc.
References DoNotifyDisassociation(), m_staInfo, m_staMac, and NS_LOG_FUNCTION.
| void ns3::PowerSaveManager::NotifyPmModeChanged | ( | WifiPowerManagementMode | pmMode, |
| linkId_t | linkId ) |
Notify that the Power Management mode of the non-AP STA operating on the given link has changed.
| pmMode | the new PM mode |
| linkId | the ID of the given link |
Definition at line 214 of file power-save-manager.cc.
References DoNotifyPmModeChanged(), m_pmModeLogger, m_staMac, NS_LOG_FUNCTION, and ns3::WIFI_PM_ACTIVE.
Notify that a Beacon frame has been received from the associated AP on the given link.
| mpdu | the MPDU carrying the Beacon frame |
| linkId | the ID of the given link |
Definition at line 232 of file power-save-manager.cc.
References DoNotifyReceivedBeacon(), GetStaInfo(), ns3::MgtBeaconHeader::GetTimestamp(), ns3::Tim::HasAid(), ns3::MgtBeaconHeader::m_beaconInterval, m_staMac, ns3::MicroSeconds(), NS_ASSERT, and NS_LOG_FUNCTION.
| void ns3::PowerSaveManager::NotifyReceivedFrameAfterPsPoll | ( | Ptr< const WifiMpdu > | mpdu, |
| linkId_t | linkId ) |
Notify the reception of a frame in response to a PS-Poll frame on the given link.
| mpdu | the received MPDU |
| linkId | the ID of the given link |
Definition at line 254 of file power-save-manager.cc.
References DoNotifyReceivedFrameAfterPsPoll(), GetStaInfo(), GetStaMac(), m_staMac, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and ns3::WIFI_PM_POWERSAVE.
Notify the reception of a groupcast frame (possibly after a DTIM) on the given link.
| mpdu | the received MPDU |
| linkId | the ID of the given link |
Definition at line 283 of file power-save-manager.cc.
References DoNotifyReceivedGroupcast(), GetStaInfo(), GetStaMac(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::WIFI_PM_POWERSAVE.
Notify that the given TXOP is requesting channel access on the given link.
| txop | the DCF/EDCAF requesting channel access |
| linkId | the ID of the given link |
Definition at line 305 of file power-save-manager.cc.
References DoNotifyRequestAccess(), and NS_LOG_FUNCTION.
| void ns3::PowerSaveManager::SetPowerSaveMode | ( | const std::map< linkId_t, bool > & | linkIdEnableMap | ) |
Enable or disable Power Save mode on a given set of links.
If this object is not initialized yet, the settings are recorded and notified to the STA wifi MAC upon initialization.
| linkIdEnableMap | a link ID-indexed map indicating whether to enable or not power save mode on the link with the given ID |
Definition at line 141 of file power-save-manager.cc.
References m_linkIdEnableMap, and m_staMac.
Referenced by GetTypeId().
| void ns3::PowerSaveManager::SetWifiMac | ( | Ptr< StaWifiMac > | mac | ) |
Set the MAC which is using this Power Save Manager.
| mac | a pointer to the MAC |
Definition at line 96 of file power-save-manager.cc.
References m_staMac, ns3::MakeCallback(), NS_LOG_FUNCTION, and TxDropped().
| void ns3::PowerSaveManager::TxDropped | ( | WifiMacDropReason | reason, |
| Ptr< const WifiMpdu > | mpdu ) |
Notify that the given MPDU has been discarded for the given reason.
| reason | the reason why the MPDU was dropped |
| mpdu | the dropped MPDU |
Definition at line 321 of file power-save-manager.cc.
References DoTxDropped(), GetStaMac(), and NS_LOG_FUNCTION.
Referenced by DoDispose(), and SetWifiMac().
|
private |
a link ID-indexed map indicating whether to enable or not power save mode on the link with the given ID (used before initialization)
Definition at line 267 of file power-save-manager.h.
Referenced by DoInitialize(), and SetPowerSaveMode().
|
private |
beacon listen interval
Definition at line 269 of file power-save-manager.h.
Referenced by GetListenInterval(), and GetTypeId().
|
private |
link ID-indexed power management mode logger
Definition at line 271 of file power-save-manager.h.
Referenced by GetTypeId(), and NotifyPmModeChanged().
link ID-indexed map of STA infos
Definition at line 265 of file power-save-manager.h.
Referenced by GetStaInfo(), GetTimeUntilNextTbtt(), NotifyAssocCompleted(), NotifyBeaconIntervalAndTimestamp(), and NotifyDisassociation().
|
private |
MAC which is using this Power Save Manager.
Definition at line 264 of file power-save-manager.h.
Referenced by DoDispose(), DoInitialize(), GetStaMac(), NotifyAssocCompleted(), NotifyDisassociation(), NotifyPmModeChanged(), NotifyReceivedBeacon(), NotifyReceivedFrameAfterPsPoll(), SetPowerSaveMode(), and SetWifiMac().