AlexaClientSDK  3.0.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 
208  virtual ContextRequestToken getContext(
209  std::shared_ptr<ContextRequesterInterface> contextRequester,
210  const std::string& endpointId = "",
211  const std::chrono::milliseconds& timeout = std::chrono::seconds(2)) = 0;
212 
239  virtual ContextRequestToken getContextWithoutReportableStateProperties(
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_
SetStateResult
Definition: ContextManagerInterface.h:39
Definition: CapabilityTag.h:32
::std::string string
Definition: gtest-port.h:1097
StateRefreshPolicy
Definition: StateRefreshPolicy.h:31
unsigned int ContextRequestToken
Alias for the token used to identify a context request.
Definition: ContextRequestToken.h:23
AlexaStateChangeCauseType
Definition: AlexaStateChangeCauseType.h:28
Definition: CapabilityState.h:31
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36

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