AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
ContextManagerInterface.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_CONTEXTMANAGERINTERFACE_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_CONTEXTMANAGERINTERFACE_H_
18 
19 #include <chrono>
20 #include <memory>
21 #include <string>
22 
29 
30 namespace alexaClientSDK {
31 namespace avsCommon {
32 namespace sdkInterfaces {
33 
39 enum class SetStateResult {
41  SUCCESS,
42 
47 
53 };
54 
64 public:
68  virtual ~ContextManagerInterface() = default;
69 
85  virtual void setStateProvider(
86  const avs::CapabilityTag& capabilityIdentifier,
87  std::shared_ptr<StateProviderInterface> stateProvider) = 0;
88 
98  virtual void addStateProvider(
99  const avsCommon::avs::CapabilityTag& capabilityIdentifier,
100  std::shared_ptr<avsCommon::sdkInterfaces::StateProviderInterface> stateProvider) = 0;
101 
107  virtual void removeStateProvider(const avs::CapabilityTag& capabilityIdentifier) = 0;
108 
137  virtual SetStateResult setState(
138  const avs::CapabilityTag& capabilityIdentifier,
139  const std::string& jsonState,
140  const avs::StateRefreshPolicy& refreshPolicy,
141  const ContextRequestToken stateRequestToken = 0) = 0;
142 
150  virtual void reportStateChange(
151  const avs::CapabilityTag& capabilityIdentifier,
152  const avs::CapabilityState& capabilityState,
153  AlexaStateChangeCauseType cause) = 0;
154 
167  virtual void provideStateResponse(
168  const avs::CapabilityTag& capabilityIdentifier,
169  const avs::CapabilityState& capabilityState,
170  ContextRequestToken stateRequestToken) = 0;
171 
183  virtual void provideStateUnavailableResponse(
184  const avs::CapabilityTag& capabilityIdentifier,
185  ContextRequestToken stateRequestToken,
186  bool isEndpointUnreachable) = 0;
187 
209  std::shared_ptr<ContextRequesterInterface> contextRequester,
210  const std::string& endpointId = "",
211  const std::chrono::milliseconds& timeout = std::chrono::seconds(2)) = 0;
212 
240  std::shared_ptr<ContextRequesterInterface> contextRequester,
241  const std::string& endpointId = "",
242  const std::chrono::milliseconds& timeout = std::chrono::seconds(2)) = 0;
243 
249  virtual void addContextManagerObserver(std::shared_ptr<ContextManagerObserverInterface> observer) = 0;
250 
256  virtual void removeContextManagerObserver(const std::shared_ptr<ContextManagerObserverInterface>& observer) = 0;
257 };
258 
259 } // namespace sdkInterfaces
260 } // namespace avsCommon
261 } // namespace alexaClientSDK
262 
263 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_CONTEXTMANAGERINTERFACE_H_
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::removeStateProvider
virtual void removeStateProvider(const avs::CapabilityTag &capabilityIdentifier)=0
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface
Definition: ContextManagerInterface.h:63
alexaClientSDK::avsCommon::sdkInterfaces::SetStateResult
SetStateResult
Definition: ContextManagerInterface.h:39
alexaClientSDK::avsCommon::sdkInterfaces::SetStateResult::STATE_PROVIDER_NOT_REGISTERED
@ STATE_PROVIDER_NOT_REGISTERED
alexaClientSDK::avsCommon::sdkInterfaces::ContextRequestToken
unsigned int ContextRequestToken
Alias for the token used to identify a context request.
Definition: ContextRequestToken.h:23
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::provideStateUnavailableResponse
virtual void provideStateUnavailableResponse(const avs::CapabilityTag &capabilityIdentifier, ContextRequestToken stateRequestToken, bool isEndpointUnreachable)=0
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::setState
virtual SetStateResult setState(const avs::CapabilityTag &capabilityIdentifier, const std::string &jsonState, const avs::StateRefreshPolicy &refreshPolicy, const ContextRequestToken stateRequestToken=0)=0
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::getContext
virtual ContextRequestToken getContext(std::shared_ptr< ContextRequesterInterface > contextRequester, const std::string &endpointId="", const std::chrono::milliseconds &timeout=std::chrono::seconds(2))=0
ContextManagerObserverInterface.h
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::reportStateChange
virtual void reportStateChange(const avs::CapabilityTag &capabilityIdentifier, const avs::CapabilityState &capabilityState, AlexaStateChangeCauseType cause)=0
alexaClientSDK::avsCommon::sdkInterfaces::AlexaStateChangeCauseType
AlexaStateChangeCauseType
Definition: AlexaStateChangeCauseType.h:28
alexaClientSDK::avsCommon::sdkInterfaces::SetStateResult::SUCCESS
@ SUCCESS
setState request was successful.
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::addStateProvider
virtual void addStateProvider(const avsCommon::avs::CapabilityTag &capabilityIdentifier, std::shared_ptr< avsCommon::sdkInterfaces::StateProviderInterface > stateProvider)=0
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
ContextRequesterInterface.h
AlexaStateChangeCauseType.h
StateProviderInterface.h
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::getContextWithoutReportableStateProperties
virtual ContextRequestToken getContextWithoutReportableStateProperties(std::shared_ptr< ContextRequesterInterface > contextRequester, const std::string &endpointId="", const std::chrono::milliseconds &timeout=std::chrono::seconds(2))=0
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::provideStateResponse
virtual void provideStateResponse(const avs::CapabilityTag &capabilityIdentifier, const avs::CapabilityState &capabilityState, ContextRequestToken stateRequestToken)=0
StateRefreshPolicy.h
alexaClientSDK::avsCommon::avs::CapabilityState
Definition: CapabilityState.h:31
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::removeContextManagerObserver
virtual void removeContextManagerObserver(const std::shared_ptr< ContextManagerObserverInterface > &observer)=0
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::addContextManagerObserver
virtual void addContextManagerObserver(std::shared_ptr< ContextManagerObserverInterface > observer)=0
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::setStateProvider
virtual void setStateProvider(const avs::CapabilityTag &capabilityIdentifier, std::shared_ptr< StateProviderInterface > stateProvider)=0
alexaClientSDK::avsCommon::sdkInterfaces::ContextManagerInterface::~ContextManagerInterface
virtual ~ContextManagerInterface()=default
alexaClientSDK::avsCommon::avs::StateRefreshPolicy
StateRefreshPolicy
Definition: StateRefreshPolicy.h:31
alexaClientSDK::avsCommon::sdkInterfaces::SetStateResult::STATE_TOKEN_OUTDATED
@ STATE_TOKEN_OUTDATED
CapabilityTag.h
alexaClientSDK::avsCommon::avs::CapabilityTag
Definition: CapabilityTag.h:32

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