AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler Class Reference

#include <PeripheralEndpointToggleControllerHandler.h>

Inheritance diagram for alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler:
Collaboration graph
[legend]

Public Member Functions

void setToggleState (bool toggleState)
 
ToggleControllerInterface methods
std::pair< avsCommon::avs::AlexaResponseType, std::string > setToggleState (bool state, avsCommon::sdkInterfaces::AlexaStateChangeCauseType cause) override
 
std::pair< avsCommon::avs::AlexaResponseType, avsCommon::utils::Optional< avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface::ToggleState > > getToggleState () override
 
bool addObserver (std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface > observer) override
 
void removeObserver (const std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface > &observer) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface
virtual ~ToggleControllerInterface ()=default
 
virtual bool addObserver (std::shared_ptr< ToggleControllerObserverInterface > observer)=0
 
virtual void removeObserver (const std::shared_ptr< ToggleControllerObserverInterface > &observer)=0
 

Static Public Member Functions

static std::shared_ptr< PeripheralEndpointToggleControllerHandlercreate (const std::string &endpointName, const std::string &instance)
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface
using ToggleState = avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface::ToggleState
 Alias to improve readability. More...
 

Detailed Description

Sample implementation of an ToggleControllerInterface.

Member Function Documentation

◆ addObserver()

bool alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler::addObserver ( std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface observer)
override

◆ create()

static std::shared_ptr<PeripheralEndpointToggleControllerHandler> alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler::create ( const std::string &  endpointName,
const std::string &  instance 
)
static

Create a PeripheralEndpointToggleControllerHandler object.

Parameters
endpointNameThe name of the endpoint.
instanceThe instance name of the capability.
Returns
A pointer to a new PeripheralEndpointToggleControllerHandler object if it succeeds; otherwise, nullptr.

◆ getToggleState()

std::pair< avsCommon::avs::AlexaResponseType, avsCommon::utils::Optional<avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface::ToggleState> > alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler::getToggleState ( )
overridevirtual

Gets the current toggle state of an instance.

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

Implements alexaClientSDK::avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface.

◆ removeObserver()

void alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler::removeObserver ( const std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerObserverInterface > &  observer)
override

◆ setToggleState() [1/2]

std::pair<avsCommon::avs::AlexaResponseType, std::string> alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler::setToggleState ( bool  state,
avsCommon::sdkInterfaces::AlexaStateChangeCauseType  cause 
)
overridevirtual

Set the toggle state of an instance.

Parameters
stateThe desired toggle state of the instance true indicates 'ON' and false as 'OFF'
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.

Implements alexaClientSDK::avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface.

◆ setToggleState() [2/2]

void alexaClientSDK::sampleApplications::common::PeripheralEndpointToggleControllerHandler::setToggleState ( bool  toggleState)

Set the toggle state the controller.

Parameters
toggleStateThe toggle state of the controller. true indicates ON and false as OFF.

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