AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PlaybackController.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_CAPABILITYAGENTS_PLAYBACKCONTROLLER_INCLUDE_PLAYBACKCONTROLLER_PLAYBACKCONTROLLER_H_
17 #define ALEXA_CLIENT_SDK_CAPABILITYAGENTS_PLAYBACKCONTROLLER_INCLUDE_PLAYBACKCONTROLLER_PLAYBACKCONTROLLER_H_
18 
19 #include <memory>
20 #include <queue>
21 #include <string>
22 
36 
37 #include "PlaybackCommand.h"
38 
39 namespace alexaClientSDK {
40 namespace capabilityAgents {
41 namespace playbackController {
42 
48  , public std::enable_shared_from_this<PlaybackController> {
49 public:
57  static std::shared_ptr<PlaybackHandlerInterface> createPlaybackHandlerInterface(
58  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
59  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
60  std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface> shutdownNotifier,
64  defaultEndpointCapabilitiesRegistrar);
65 
73  static std::shared_ptr<PlaybackController> create(
74  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
75  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender);
76 
80  virtual ~PlaybackController() = default;
81 
84  void onContextAvailable(const std::string& jsonContext) override;
87 
90  void onButtonPressed(avsCommon::avs::PlaybackButton button) override;
91  void onTogglePressed(avsCommon::avs::PlaybackToggle toggle, bool action) override;
93 
96  std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> getCapabilityConfigurations() override;
98 
105  void messageSent(
106  const PlaybackCommand&,
108 
109 private:
117  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
118  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender);
119 
120  // @name RequiresShutdown Functions
122  void doShutdown() override;
124 
130  void handleCommand(const PlaybackCommand& command);
131 
138 
141  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> m_messageSender;
142 
144  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> m_contextManager;
145 
147  std::queue<const PlaybackCommand*> m_commands;
149 
151  std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> m_capabilityConfigurations;
152 
155 };
156 
157 } // namespace playbackController
158 } // namespace capabilityAgents
159 } // namespace alexaClientSDK
160 
161 #endif // ALEXA_CLIENT_SDK_CAPABILITYAGENTS_PLAYBACKCONTROLLER_INCLUDE_PLAYBACKCONTROLLER_PLAYBACKCONTROLLER_H_
void onContextAvailable(const std::string &jsonContext) override
void onContextFailure(const avsCommon::sdkInterfaces::ContextRequestError error) override
::std::string string
Definition: gtest-port.h:1097
ContextRequestError
Definition: ContextRequesterInterface.h:40
Single-thread executor implementation.
Definition: Executor.h:45
PlaybackButton
Enumeration class for supported playback buttons.
Definition: PlaybackButtons.h:26
void messageSent(const PlaybackCommand &, avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status messageStatus)
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static std::shared_ptr< PlaybackController > create(std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender)
void onTogglePressed(avsCommon::avs::PlaybackToggle toggle, bool action) override
void onButtonPressed(avsCommon::avs::PlaybackButton button) override
static std::shared_ptr< PlaybackHandlerInterface > createPlaybackHandlerInterface(std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > shutdownNotifier, acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > defaultEndpointCapabilitiesRegistrar)
std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations() override
Status
Definition: MessageRequestObserverInterface.h:33
PlaybackToggle
Definition: PlaybackButtons.h:46
action
Definition: upload.py:393

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