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

#include <PowerControllerInterface.h>

Inheritance diagram for alexaClientSDK::avsCommon::sdkInterfaces::powerController::PowerControllerInterface:
Inheritance graph

Public Types

using PowerState = avsCommon::sdkInterfaces::powerController::PowerControllerObserverInterface::PowerState

Public Member Functions

virtual ~PowerControllerInterface ()=default
virtual std::pair< avsCommon::avs::AlexaResponseType, std::string > setPowerState (bool powerState, AlexaStateChangeCauseType cause)=0
virtual std::pair< avsCommon::avs::AlexaResponseType, utils::Optional< PowerState > > getPowerState ()=0
virtual bool addObserver (std::shared_ptr< PowerControllerObserverInterface > observer)=0
virtual void removeObserver (const std::shared_ptr< PowerControllerObserverInterface > &observer)=0

Detailed Description

The PowerControllerInterface carries out power controller actions such as turning the endpoint ‘ON’ or ‘OFF’.

An implementation of the PowerControllerInterface controls the endpoint’s power state and may allow its methods to be called by multiple callers; for example the Alexa Capability Agent or the application’s GUI.

Implementations of this interface must be thread-safe.

Member Typedef Documentation

◆ PowerState

Constructor & Destructor Documentation

◆ ~PowerControllerInterface()

virtual alexaClientSDK::avsCommon::sdkInterfaces::powerController::PowerControllerInterface::~PowerControllerInterface ( )

Virtual destructor to assure proper cleanup of derived types.

Member Function Documentation

◆ addObserver()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::powerController::PowerControllerInterface::addObserver ( std::shared_ptr< PowerControllerObserverInterface observer)
pure virtual

Adds a PowerControllerObserverInterface observer.

If PowerControllerInterface implementation has configured its instance's property as proactively reported, then it is required to notify observers of PowerControllerObserverInterface for any change in its property state. This includes notifying the value when the device starts, if it is different from the last reported value.
observerThe pointer to the PowerControllerObserverInterface.
true if the object supports observer notification and observer was successfully added; otherwise, return false

◆ getPowerState()

virtual std::pair<avsCommon::avs::AlexaResponseType, utils::Optional<PowerState> > alexaClientSDK::avsCommon::sdkInterfaces::powerController::PowerControllerInterface::getPowerState ( )
pure virtual

Get the current power state of the endpoint.

On successful, the endpoint to return a pair with AlexaResponseType::SUCCESS and PowerState otherwise returns a pair with the appropriate reason from AlexaResponseType and a empty PowerState

Implemented in alexaClientSDK::sampleApp::PeripheralEndpointPowerControllerHandler.

◆ removeObserver()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::powerController::PowerControllerInterface::removeObserver ( const std::shared_ptr< PowerControllerObserverInterface > &  observer)
pure virtual

Removes a observer of PowerControllerObserverInterface.

observerThe pointer to the PowerControllerObserverInterface.

◆ setPowerState()

virtual std::pair<avsCommon::avs::AlexaResponseType, std::string> alexaClientSDK::avsCommon::sdkInterfaces::powerController::PowerControllerInterface::setPowerState ( bool  powerState,
AlexaStateChangeCauseType  cause 
pure virtual

Set the power state of the endpoint.

powerStateThe desired power state of the endpoint, true indicates 'ON' and false as 'OFF'
causeThe cause type for this action represented using AlexaStateChangeCauseType.
A pair of AlexaResponseType and string. For the successful operation, the controller should return a pair with AlexaResponseType::SUCCESS with an empty string, otherwise returns a pair with the appropriate reason from AlexaResponseType and a string with log message that would be logged in cloud for debugging purpose.

Implemented in alexaClientSDK::sampleApp::PeripheralEndpointPowerControllerHandler.

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

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