AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PlaybackRouter.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_PLAYBACKROUTER_H_
17 #define ALEXA_CLIENT_SDK_CAPABILITYAGENTS_PLAYBACKCONTROLLER_INCLUDE_PLAYBACKCONTROLLER_PLAYBACKROUTER_H_
18 
23 
24 namespace alexaClientSDK {
25 namespace capabilityAgents {
26 namespace playbackController {
27 
31  , public std::enable_shared_from_this<PlaybackRouter> {
32 public:
40  static std::shared_ptr<PlaybackRouterInterface> createPlaybackRouterInterface(
41  std::shared_ptr<avsCommon::sdkInterfaces::PlaybackHandlerInterface> defaultHandler,
42  std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface> shutdownNotifier);
43 
51  static std::shared_ptr<PlaybackRouter> create(
52  std::shared_ptr<avsCommon::sdkInterfaces::PlaybackHandlerInterface> defaultHandler);
53 
57  virtual ~PlaybackRouter() = default;
58 
61  virtual void buttonPressed(avsCommon::avs::PlaybackButton button) override;
62  virtual void togglePressed(avsCommon::avs::PlaybackToggle toggle, bool action) override;
63  virtual void switchToDefaultHandler() override;
64  virtual void setHandler(
65  std::shared_ptr<avsCommon::sdkInterfaces::PlaybackHandlerInterface> handler,
66  std::shared_ptr<avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface> localHandler = nullptr) override;
67  virtual void useDefaultHandlerWith(
68  std::shared_ptr<avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface> localHandler) override;
70  virtual bool localSeekTo(std::chrono::milliseconds location, bool fromStart) override;
72 
73 private:
77  PlaybackRouter(std::shared_ptr<avsCommon::sdkInterfaces::PlaybackHandlerInterface> defaultHandler);
78 
81  void doShutdown() override;
83 
85  std::shared_ptr<avsCommon::sdkInterfaces::PlaybackHandlerInterface> m_handler;
86 
88  std::shared_ptr<avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface> m_localHandler;
89 
91  std::shared_ptr<avsCommon::sdkInterfaces::PlaybackHandlerInterface> m_defaultHandler;
92 
94  std::mutex m_handlerMutex;
95 };
96 
97 } // namespace playbackController
98 } // namespace capabilityAgents
99 } // namespace alexaClientSDK
100 
101 #endif // ALEXA_CLIENT_SDK_CAPABILITYAGENTS_PLAYBACKCONTROLLER_INCLUDE_PLAYBACKCONTROLLER_PLAYBACKROUTER_H_
virtual bool localSeekTo(std::chrono::milliseconds location, bool fromStart) override
virtual void buttonPressed(avsCommon::avs::PlaybackButton button) override
virtual void togglePressed(avsCommon::avs::PlaybackToggle toggle, bool action) override
virtual void useDefaultHandlerWith(std::shared_ptr< avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface > localHandler) override
static std::shared_ptr< PlaybackRouter > create(std::shared_ptr< avsCommon::sdkInterfaces::PlaybackHandlerInterface > defaultHandler)
PlaybackButton
Enumeration class for supported playback buttons.
Definition: PlaybackButtons.h:26
PlaybackOperation
Definition: LocalPlaybackHandlerInterface.h:40
static std::shared_ptr< PlaybackRouterInterface > createPlaybackRouterInterface(std::shared_ptr< avsCommon::sdkInterfaces::PlaybackHandlerInterface > defaultHandler, std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > shutdownNotifier)
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
virtual void setHandler(std::shared_ptr< avsCommon::sdkInterfaces::PlaybackHandlerInterface > handler, std::shared_ptr< avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface > localHandler=nullptr) override
PlaybackToggle
Definition: PlaybackButtons.h:46
virtual bool localOperation(avsCommon::sdkInterfaces::LocalPlaybackHandlerInterface::PlaybackOperation op) override
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