AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
alexaClientSDK::avsCommon::utils::power::PowerResource Class Reference

#include <PowerResource.h>

Public Member Functions

 ~PowerResource ()
std::string getId () const
bool isRefCounted () const
bool isFrozen () const
sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel getLevel () const
void acquire ()
void release ()
void freeze ()
void thaw ()

Static Public Member Functions

static std::shared_ptr< PowerResourcecreate (const std::string &identifier, std::shared_ptr< sdkInterfaces::PowerResourceManagerInterface > powerManager, sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel level=sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel::STANDBY_MED, bool refCounted=true)

Static Public Attributes

static constexpr const char * PREFIX = "ACSDK_"

Detailed Description

An object representing a configuration of power level preferences.

Behavior is undefined if direct calls are made to PowerResourceManagerInterface using the same component identifier as one associated with a PowerResource object.

Constructor & Destructor Documentation

◆ ~PowerResource()

alexaClientSDK::avsCommon::utils::power::PowerResource::~PowerResource ( )

Destructor. This will release all acquired instances.

Member Function Documentation

◆ acquire()

void alexaClientSDK::avsCommon::utils::power::PowerResource::acquire ( )

Acquire a count of the resource.

◆ create()

std::shared_ptr< PowerResource > alexaClientSDK::avsCommon::utils::power::PowerResource::create ( const std::string &  identifier,
std::shared_ptr< sdkInterfaces::PowerResourceManagerInterface powerManager,
sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel  level = sdkInterfaces::PowerResourceManagerInterface::PowerResourceLevel::STANDBY_MED,
bool  refCounted = true 

Creates an instance of the PowerResource.

identifierThe identifier. This identifier must be unique across all instances, as it will be used to call the underlying PowerResourceManagerInterface. This will be prefixed internally with ACSDK_ to maintain uniqueness within PowerResourceManagerInterface.
powerManagerA pointer to the underlying PowerResourceManagerInterface.
levelThe level to create this resource with.
refCountedWhether refcounting is enabled.
An instance.

◆ freeze()

void alexaClientSDK::avsCommon::utils::power::PowerResource::freeze ( )

Freezes the resource, and caches the current refcount. Any calls to acquire or release will no-op while the PowerResource is frozen.

◆ getId()

std::string alexaClientSDK::avsCommon::utils::power::PowerResource::getId ( ) const

Returns the id. This will equal the identifier passed into the constructor without the internal prefix.

A string representing the id.

◆ getLevel()

PowerResourceManagerInterface::PowerResourceLevel alexaClientSDK::avsCommon::utils::power::PowerResource::getLevel ( ) const

Get the current level.

The current level.

◆ isFrozen()

bool alexaClientSDK::avsCommon::utils::power::PowerResource::isFrozen ( ) const

Returns whether the current resource is frozen.

A bool indicating frozen state.

◆ isRefCounted()

bool alexaClientSDK::avsCommon::utils::power::PowerResource::isRefCounted ( ) const

Returns whether the current resource is refCounted.

A bool indicating refCount state.

◆ release()

void alexaClientSDK::avsCommon::utils::power::PowerResource::release ( )

Release a count of the resource.

◆ thaw()

void alexaClientSDK::avsCommon::utils::power::PowerResource::thaw ( )

Thaws the resource, and re-acquires the amount of times the resource has been acquired.

Member Data Documentation


constexpr const char* alexaClientSDK::avsCommon::utils::power::PowerResource::PREFIX = "ACSDK_"

Prefix that will be internally appended before calling PowerResourceManagerInterface.

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

AlexaClientSDK 1.26.0 - Copyright 2016-2021, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0