AlexaClientSDK  1.22.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Types | Public Member Functions | List of all members
alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface Class Referenceabstract

#include <PowerResourceManagerInterface.h>

Inheritance diagram for alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface:
Inheritance graph
[legend]

Classes

class  PowerResourceId
 

Public Types

enum  PowerResourceLevel {
  PowerResourceLevel::STANDBY_LOW = 0, PowerResourceLevel::STANDBY_MED, PowerResourceLevel::STANDBY_HIGH, PowerResourceLevel::ACTIVE_LOW,
  PowerResourceLevel::ACTIVE_MED, PowerResourceLevel::ACTIVE_HIGH
}
 

Public Member Functions

virtual ~PowerResourceManagerInterface ()=default
 
virtual void acquirePowerResource (const std::string &component, const PowerResourceLevel level=PowerResourceLevel::STANDBY_MED)=0
 
virtual void releasePowerResource (const std::string &component)=0
 
virtual bool isPowerResourceAcquired (const std::string &component)=0
 
virtual std::chrono::milliseconds getTimeSinceLastResumeMS ()
 
virtual std::shared_ptr< PowerResourceIdcreate (const std::string &resourceId, bool isRefCounted=true, const PowerResourceLevel level=PowerResourceLevel::STANDBY_MED)=0
 
virtual bool acquire (const std::shared_ptr< PowerResourceId > &id, const std::chrono::milliseconds autoReleaseTimeout=std::chrono::milliseconds::zero())=0
 
virtual bool release (const std::shared_ptr< PowerResourceId > &id)=0
 
virtual bool close (const std::shared_ptr< PowerResourceId > &id)=0
 

Detailed Description

This interface provides APIs for components of AVS-SDK to manage power resources. These components, such as AudioInputProcessor and SpeechSynthesizer, can claim the level of power resource they need when active (listening or speacking) by invoking the acquirePowerResource API, such that the power management system keeps the hardware devices works in the claimed power levels. When the component is inactive, it invokes the releasePowerResource API to release the acquired power resource level. This interface defined 6 power resource levels. To implement this interface, the user need define a mapping from them to the real power resource levels of the power management system.

Member Enumeration Documentation

◆ PowerResourceLevel

Power resource levels. Each hardware device may have multiple STANDBY and ACTIVE power modes. For example, CPU can work in different frequency and number of cores. It has a latency to switch from low power mode to high power mode, and the latency increases with the gaps of the power levels. Power management system defines a group of power polices; each policy specifies the power modes of hardware components. To implement this interface, the user needs to map the power polices (that allow applications to proactively claim) to the 6 power resource levels we defined in this enumaration.

Enumerator
STANDBY_LOW 
STANDBY_MED 
STANDBY_HIGH 
ACTIVE_LOW 
ACTIVE_MED 
ACTIVE_HIGH 

Constructor & Destructor Documentation

◆ ~PowerResourceManagerInterface()

virtual alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface::~PowerResourceManagerInterface ( )
virtualdefault

Destructor

Member Function Documentation

◆ acquire()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface::acquire ( const std::shared_ptr< PowerResourceId > &  id,
const std::chrono::milliseconds  autoReleaseTimeout = std::chrono::milliseconds::zero() 
)
pure virtual

Acquire a power resource.

Parameters
idshared pointer of type PowerResourceId representing the resource.
autoReleaseTimeoutauto release timeout value. Zero denotes auto release disabled.
Returns
true if acquire was successful, false if it failed.

Implemented in alexaClientSDK::avsCommon::utils::power::NoOpPowerResourceManager.

◆ acquirePowerResource()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface::acquirePowerResource ( const std::string &  component,
const PowerResourceLevel  level = PowerResourceLevel::STANDBY_MED 
)
pure virtual

Acquire a power resource for the component.

Parameters
componentcomponent name.
levelpower resource level.

Implemented in alexaClientSDK::avsCommon::utils::power::AggregatedPowerResourceManager, and alexaClientSDK::avsCommon::utils::power::NoOpPowerResourceManager.

◆ close()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface::close ( const std::shared_ptr< PowerResourceId > &  id)
pure virtual

Close a power resource.

Parameters
idshared pointer of type PowerResourceId representing the resource.
Returns
true if close was successful, false if it failed.

Implemented in alexaClientSDK::avsCommon::utils::power::NoOpPowerResourceManager.

◆ create()

virtual std::shared_ptr<PowerResourceId> alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface::create ( const std::string &  resourceId,
bool  isRefCounted = true,
const PowerResourceLevel  level = PowerResourceLevel::STANDBY_MED 
)
pure virtual

Create a power resource keyed by the unique string resourceId.

Parameters
resourceIdmentions what the resource is for.
isRefCountedwhether refcounting is enabled for this resource
levelpower resource level.
Returns
shared pointer of type PowerResourceId representing the resource

Implemented in alexaClientSDK::avsCommon::utils::power::AggregatedPowerResourceManager, and alexaClientSDK::avsCommon::utils::power::NoOpPowerResourceManager.

◆ getTimeSinceLastResumeMS()

std::chrono::milliseconds alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface::getTimeSinceLastResumeMS ( )
inlinevirtual

Acquires the time since latest system resume.

Returns
time since last system resume, if implemented by power manager, zero otherwise.

Provides the default PowerResourceManagerInterface time since last resume in MS.

Returns
Return default value of 0 milliseconds in the form of std::chrono::milliseconds.

◆ isPowerResourceAcquired()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface::isPowerResourceAcquired ( const std::string &  component)
pure virtual

Checks whether a power resource had been acquired or not.

Parameters
componentcomponent name.
Returns
true if the power resource had been acquired, otherwise return false.

Implemented in alexaClientSDK::avsCommon::utils::power::AggregatedPowerResourceManager, and alexaClientSDK::avsCommon::utils::power::NoOpPowerResourceManager.

◆ release()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface::release ( const std::shared_ptr< PowerResourceId > &  id)
pure virtual

Release a power resource.

Parameters
idshared pointer of type PowerResourceId representing the resource.
Returns
true if release was successful, false if it failed.

Implemented in alexaClientSDK::avsCommon::utils::power::NoOpPowerResourceManager.

◆ releasePowerResource()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::PowerResourceManagerInterface::releasePowerResource ( const std::string &  component)
pure virtual

Release the acquired power resource of the specified component.

Parameters
componentcomponent name.

Implemented in alexaClientSDK::avsCommon::utils::power::AggregatedPowerResourceManager, and alexaClientSDK::avsCommon::utils::power::NoOpPowerResourceManager.


The documentation for this class was generated from the following file:

AlexaClientSDK 1.22.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0