AlexaClientSDK  3.0.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::modeController::ModeControllerInterface Class Referenceabstract

#include <ModeControllerInterface.h>

Inheritance diagram for alexaClientSDK::avsCommon::sdkInterfaces::modeController::ModeControllerInterface:
Inheritance graph
[legend]

Public Types

using ModeState = avsCommon::sdkInterfaces::modeController::ModeControllerObserverInterface::ModeState
 Alias to improve readability. More...
 
using ModeControllerConfiguration = std::vector< std::string >
 

Public Member Functions

virtual ~ModeControllerInterface ()=default
 
virtual ModeControllerConfiguration getConfiguration ()=0
 
virtual std::pair< avsCommon::avs::AlexaResponseType, std::string > setMode (const std::string &mode, AlexaStateChangeCauseType cause)=0
 
virtual std::pair< avsCommon::avs::AlexaResponseType, std::string > adjustMode (int modeDelta, AlexaStateChangeCauseType cause)=0
 
virtual std::pair< avsCommon::avs::AlexaResponseType, utils::Optional< ModeState > > getMode ()=0
 
virtual bool addObserver (std::shared_ptr< ModeControllerObserverInterface > observer)=0
 
virtual void removeObserver (const std::shared_ptr< ModeControllerObserverInterface > &observer)=0
 

Detailed Description

The ModeControllerInterface carries out mode actions on an instance of an endpoint.

An implementation of the ModeControllerInterface controls the instance's mode and may allow its methods to be called by multiple callers; for example the Alexa Capability Agent or the application’s GUI.

Note
Implementations of this interface must be thread-safe.

Member Typedef Documentation

◆ ModeControllerConfiguration

The configuration of the mode controller that represents the supported modes as a vector of string

◆ ModeState

Alias to improve readability.

Constructor & Destructor Documentation

◆ ~ModeControllerInterface()

virtual alexaClientSDK::avsCommon::sdkInterfaces::modeController::ModeControllerInterface::~ModeControllerInterface ( )
virtualdefault

Virtual destructor to assure proper cleanup of derived types.

Member Function Documentation

◆ addObserver()

virtual bool alexaClientSDK::avsCommon::sdkInterfaces::modeController::ModeControllerInterface::addObserver ( std::shared_ptr< ModeControllerObserverInterface observer)
pure virtual

Adds a ModeControllerObserverInterface observer

Note
If ModeControllerInterface implementation has configured its instance's property as proactively reported, then it is required to notify observers of ModeControllerObserverInterface 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.
Parameters
observerThe pointer to the ModeControllerObserverInterface.
Returns
true if the object supports observer notification and observer was successfully added; otherwise, return false

◆ adjustMode()

virtual std::pair<avsCommon::avs::AlexaResponseType, std::string> alexaClientSDK::avsCommon::sdkInterfaces::modeController::ModeControllerInterface::adjustMode ( int  modeDelta,
AlexaStateChangeCauseType  cause 
)
pure virtual

Adjust the mode of an instance.

Parameters
modeDeltaThe delta by which the controller mode should be changed (only applicable if the mode controller is ordered).
causeThe appropriate AlexaStateChangeCauseType for this change.
Returns
A pair of AlexaResponseType and string. For the successful operation, the controller should return a pair of AlexaResponseType::SUCCESS with an empty string, otherwise it returns pair with the appropriate reason from AlexaResponseType and a description of the error.

Implemented in alexaClientSDK::sampleApplications::common::DefaultEndpointModeControllerHandler, and alexaClientSDK::sampleApplications::common::PeripheralEndpointModeControllerHandler.

◆ getConfiguration()

virtual ModeControllerConfiguration alexaClientSDK::avsCommon::sdkInterfaces::modeController::ModeControllerInterface::getConfiguration ( )
pure virtual

Gets the controller configuration as defined ModeControllerConfiguration

Returns
ModeControllerConfiguration

Implemented in alexaClientSDK::sampleApplications::common::DefaultEndpointModeControllerHandler, and alexaClientSDK::sampleApplications::common::PeripheralEndpointModeControllerHandler.

◆ getMode()

virtual std::pair<avsCommon::avs::AlexaResponseType, utils::Optional<ModeState> > alexaClientSDK::avsCommon::sdkInterfaces::modeController::ModeControllerInterface::getMode ( )
pure virtual

Gets the current mode of the instance.

Returns
On successful, the instance to return a pair with AlexaResponseType::SUCCESS and ModeState otherwise returns a pair with the appropriate reason from AlexaResponseType and an empty ModeState.

Implemented in alexaClientSDK::sampleApplications::common::DefaultEndpointModeControllerHandler, and alexaClientSDK::sampleApplications::common::PeripheralEndpointModeControllerHandler.

◆ removeObserver()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::modeController::ModeControllerInterface::removeObserver ( const std::shared_ptr< ModeControllerObserverInterface > &  observer)
pure virtual

Removes an observer.

Parameters
observerThe pointer to the ModeControllerObserverInterface.

◆ setMode()

virtual std::pair<avsCommon::avs::AlexaResponseType, std::string> alexaClientSDK::avsCommon::sdkInterfaces::modeController::ModeControllerInterface::setMode ( const std::string &  mode,
AlexaStateChangeCauseType  cause 
)
pure virtual

Set the mode of the instance.

Parameters
modeThe desired mode of the instance.
causeThe cause type for this action represented using AlexaStateChangeCauseType.
Returns
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 description of the error.

Implemented in alexaClientSDK::sampleApplications::common::DefaultEndpointModeControllerHandler, and alexaClientSDK::sampleApplications::common::PeripheralEndpointModeControllerHandler.


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

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