AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <PowerMonitor.h>
Public Member Functions | |
void | activate (std::shared_ptr< sdkInterfaces::PowerResourceManagerInterface > powerManager) |
bool | isActive () |
void | deactivate () |
std::shared_ptr< sdkInterfaces::PowerResourceManagerInterface > | getPowerResourceManager () |
std::shared_ptr< PowerResource > | getThreadPowerResourceOrCreate (const std::string &identifier, sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel level=sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel::STANDBY_MED) |
std::shared_ptr< PowerResource > | getThreadPowerResource () |
std::shared_ptr< PowerResource > | assignThreadPowerResource (std::shared_ptr< PowerResource > powerResource) |
std::shared_ptr< PowerResource > | createLocalPowerResource (const std::string &identifier, sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel level=sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel::STANDBY_MED) |
void | removeThreadPowerResource () |
Static Public Member Functions | |
static std::shared_ptr< PowerMonitor > | getInstance () |
A class providing power monitoring capabilities for the SDK. To use this object, activate() must first be called.
This must be activated before any components are created that may have power management logic. For applications that wish to use any of the Power related primitives, this may mean calling activate() outside the SDK.
void alexaClientSDK::avsCommon::utils::power::PowerMonitor::activate | ( | std::shared_ptr< sdkInterfaces::PowerResourceManagerInterface > | powerManager | ) |
Iniitalizes the PowerMonitor
with a PowerResourceManagerInterface
and activates.
powerManager | A PowerResourceManagerInterface instance. |
std::shared_ptr<PowerResource> alexaClientSDK::avsCommon::utils::power::PowerMonitor::assignThreadPowerResource | ( | std::shared_ptr< PowerResource > | powerResource | ) |
Assigns a previously created PowerResource
to a thread. This will not affect the state of the PowerResource
. If there is a previously assigned PowerResource
this will fail.
powerResource | The PowerResource to assign. |
PowerResource
if successful, else a nullptr. std::shared_ptr<PowerResource> alexaClientSDK::avsCommon::utils::power::PowerMonitor::createLocalPowerResource | ( | const std::string & | identifier, |
sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel | level = sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel::STANDBY_MED |
||
) |
Convenience method for creating a local (non-thread associated) PowerResource
using getPowerManager().
The | identifier to create the local PowerResource with. |
level | The PowerResourceLevel to use. |
PowerResource
. void alexaClientSDK::avsCommon::utils::power::PowerMonitor::deactivate | ( | ) |
Deactivate the PowerMonitor
. This clears the internal map and resets the PowerManagerResourceMangerInterface
instance.
|
static |
Returns an instance of PowerMonitor
. This is guaranteed to be non-null.
PowerMonitor
. std::shared_ptr<sdkInterfaces::PowerResourceManagerInterface> alexaClientSDK::avsCommon::utils::power::PowerMonitor::getPowerResourceManager | ( | ) |
Get the PowerResourceManagerInterface
.
PowerResourceManagerInterface
. std::shared_ptr<PowerResource> alexaClientSDK::avsCommon::utils::power::PowerMonitor::getThreadPowerResource | ( | ) |
Get the PowerResource
associated with the current thread.
PowerResource
associated with the current thread. std::shared_ptr<PowerResource> alexaClientSDK::avsCommon::utils::power::PowerMonitor::getThreadPowerResourceOrCreate | ( | const std::string & | identifier, |
sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel | level = sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel::STANDBY_MED |
||
) |
Gets the PowerResource
associated with the current thread, or create one if none are associated. The same identifier must be used with a particular thread. The creator of the thread PowerResource is responsible for cleaning it up via removeThreadPowerResource(). This should typically be done when the thread exits.
identifier | The identifier to create the thread PowerResource if none exists. |
level | The PowerResourceLevel to use on first creation. Otherwise this is ignored. |
PowerResource
associated with the current thread. bool alexaClientSDK::avsCommon::utils::power::PowerMonitor::isActive | ( | ) |
Whether the PowerMonitor
has been activated with an PowerResourceManagerInterface
.
void alexaClientSDK::avsCommon::utils::power::PowerMonitor::removeThreadPowerResource | ( | ) |
Remove the current PowerResource
associated with this thread.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0