AlexaClientSDK  1.20.1
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | List of all members
alexaClientSDK::avsCommon::avs::AVSContext Class Reference

#include <AVSContext.h>

Public Types

using States = std::map< CapabilityTag, CapabilityState >
 Alias the map of states. More...

Public Member Functions

 AVSContext ()=default
std::string toJson () const
States getStates () const
utils::Optional< CapabilityStategetState (const CapabilityTag &identifier) const
void addState (const CapabilityTag &identifier, const CapabilityState &state)
void removeState (const CapabilityTag &identifier)

Detailed Description

The AVSContext represents a map where the key is the capabilities message identifier, which represents a unique property in the device, and the value is their current state.

This class is not thread safe.

Member Typedef Documentation

◆ States

Alias the map of states.

Constructor & Destructor Documentation

◆ AVSContext()

alexaClientSDK::avsCommon::avs::AVSContext::AVSContext ( )


Member Function Documentation

◆ addState()

void alexaClientSDK::avsCommon::avs::AVSContext::addState ( const CapabilityTag identifier,
const CapabilityState state 

Add the state for an specific capability.

identifierThe target capability identifier.
stateThe state to be saved.
If the context already has a state for the given capability, this function will overwrite the existing state.

◆ getState()

utils::Optional< CapabilityState > alexaClientSDK::avsCommon::avs::AVSContext::getState ( const CapabilityTag identifier) const

Get state of an specific capability if available.

identifierThe target capability identifier.
The capability state if available; otherwise, an empty object.

◆ getStates()

std::map< CapabilityTag, CapabilityState > alexaClientSDK::avsCommon::avs::AVSContext::getStates ( ) const

Get all states available in this context.

A map with all the states available in this context.

◆ removeState()

void alexaClientSDK::avsCommon::avs::AVSContext::removeState ( const CapabilityTag identifier)

Remove the state of an specific capability.

identifierThe target capability identifier.

◆ toJson()

std::string alexaClientSDK::avsCommon::avs::AVSContext::toJson ( ) const

Return a stringified json representation of AVSContext value.

A stringified json following AVS format specification.

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

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