![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <ToggleControllerInterface.h>
Public Types | |
using | ToggleState = avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface::ToggleState |
Alias to improve readability. More... | |
Public Member Functions | |
virtual | ~ToggleControllerInterface ()=default |
virtual std::pair< avsCommon::avs::AlexaResponseType, std::string > | setToggleState (bool state, AlexaStateChangeCauseType cause)=0 |
virtual std::pair< avsCommon::avs::AlexaResponseType, utils::Optional< ToggleState > > | getToggleState ()=0 |
virtual bool | addObserver (std::shared_ptr< ToggleControllerObserverInterface > observer)=0 |
virtual void | removeObserver (const std::shared_ptr< ToggleControllerObserverInterface > &observer)=0 |
The ToggleControllerInterface carries out toggle actions on an instance of an endpoint, such as turning it 'ON or 'OFF'.
An implementation of the ToggleControllerInterface controls the instance's toggle state and may allow its methods to be called by multiple callers; for example the Alexa Capability Agent or the application’s GUI.
using alexaClientSDK::avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface::ToggleState = avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface::ToggleState |
Alias to improve readability.
|
virtualdefault |
Virtual destructor to assure proper cleanup of derived types.
|
pure virtual |
Adds a ToggleControllerObserverInterface
observer.
ToggleControllerObserverInterface
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.observer | The pointer to the ToggleControllerObserverInterface . |
true
if the object supports observer notification and observer was successfully added; otherwise, return false
|
pure virtual |
Gets the current toggle state of an instance.
AlexaResponseType::SUCCESS
and ToggleState
otherwise returns a pair with the appropriate reason from AlexaResponseType
and a empty ToggleState
. Implemented in alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler, and alexaClientSDK::sampleApplications::common::DefaultEndpointToggleControllerHandler.
|
pure virtual |
Removes a observer of ToggleControllerObserverInterface
.
observer | The pointer to the ToggleControllerObserverInterface . |
|
pure virtual |
Set the toggle state of an instance.
state | The desired toggle state of the instance true indicates 'ON' and false as 'OFF' |
cause | The cause type for this action represented using AlexaStateChangeCauseType . |
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::PeripheralEndpointToggleControllerHandler, and alexaClientSDK::sampleApplications::common::DefaultEndpointToggleControllerHandler.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0