16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_POWER_AGGREGATEDPOWERRESOURCEMANAGER_H_ 17 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_POWER_AGGREGATEDPOWERRESOURCEMANAGER_H_ 22 #include <unordered_map> 56 static std::shared_ptr<AggregatedPowerResourceManager>
create(
57 std::shared_ptr<avsCommon::sdkInterfaces::PowerResourceManagerInterface> powerResourceManager);
71 std::shared_ptr<avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceId>
create(
73 bool isRefCounted =
true,
76 const std::shared_ptr<avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceId>&
id,
77 const std::chrono::milliseconds autoReleaseTimeout = std::chrono::milliseconds::zero())
override;
79 const std::shared_ptr<avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceId>&
id)
override;
81 const std::shared_ptr<avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceId>&
id)
override;
86 using AggregatedPowerResourceMap = std::unordered_map<
88 std::shared_ptr<avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceId>,
95 struct PowerResourceInfo {
104 avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel level);
109 void updateLastAcquiredTimepoint();
112 const bool isRefCounted;
115 const avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel level;
121 std::chrono::system_clock::time_point lastAcquired;
130 std::shared_ptr<avsCommon::sdkInterfaces::PowerResourceManagerInterface> powerResourceManager);
135 void logActivePowerResources();
143 std::shared_ptr<PowerResourceId> getAggregatedPowerResourceIdLocked(
150 std::shared_ptr<avsCommon::sdkInterfaces::PowerResourceManagerInterface> m_appPowerResourceManager;
154 std::unordered_map<std::string, PowerResourceInfo> m_ids;
157 AggregatedPowerResourceMap m_aggregatedPowerResources;
171 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_POWER_AGGREGATEDPOWERRESOURCEMANAGER_H_ STANDBY_MED usually means all the hardware components work in the medium standby power levels...
PowerResourceLevel
Definition: PowerResourceManagerInterface.h:49
::std::string string
Definition: gtest-port.h:1097
bool acquire(const std::shared_ptr< avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceId > &id, const std::chrono::milliseconds autoReleaseTimeout=std::chrono::milliseconds::zero()) override
virtual ~AggregatedPowerResourceManager()
Destructor.
void releasePowerResource(const std::string &component) override
void acquirePowerResource(const std::string &component, const PowerResourceLevel level=PowerResourceLevel::STANDBY_MED) override
static std::shared_ptr< AggregatedPowerResourceManager > create(std::shared_ptr< avsCommon::sdkInterfaces::PowerResourceManagerInterface > powerResourceManager)
Definition: AggregatedPowerResourceManager.h:48
Timer to schedule task for delayed and periodic execution.
Definition: Timer.h:39
bool close(const std::shared_ptr< avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceId > &id) override
Definition: PowerResourceManagerInterface.h:38
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
bool isPowerResourceAcquired(const std::string &component) override
bool release(const std::shared_ptr< avsCommon::sdkInterfaces::PowerResourceManagerInterface::PowerResourceId > &id) override