AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
StaticExternalMediaPlayerAdapterHandler.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_ACSDKEXTERNALMEDIAPLAYER_INCLUDE_ACSDKEXTERNALMEDIAPLAYER_STATICEXTERNALMEDIAPLAYERADAPTERHANDLER_H_
17 #define ALEXA_CLIENT_SDK_ACSDKEXTERNALMEDIAPLAYER_INCLUDE_ACSDKEXTERNALMEDIAPLAYER_STATICEXTERNALMEDIAPLAYERADAPTERHANDLER_H_
18 
19 #include <unordered_map>
20 
22 
23 namespace alexaClientSDK {
24 namespace acsdkExternalMediaPlayer {
25 
28 public:
31 
33  ~StaticExternalMediaPlayerAdapterHandler() override = default;
34 
41  void addAdapter(
42  const std::string& localPlayerId,
43  std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface> adapter);
44 
46  virtual void doShutdown() override;
47 
50  std::vector<acsdkExternalMediaPlayerInterfaces::PlayerInfo> updatePlayerInfo(
51  const std::vector<acsdkExternalMediaPlayerInterfaces::PlayerInfo>& playerList) override;
52  bool login(
53  const std::string& localPlayerId,
54  const std::string& accessToken,
55  const std::string& userName,
56  bool forceLogin,
57  std::chrono::milliseconds tokenRefreshInterval) override;
58  bool logout(const std::string& localPlayerId) override;
59  bool play(const PlayParams& params) override;
60  bool playControl(
61  const std::string& localPlayerId,
63  const std::string& playbackTarget) override;
64  bool seek(const std::string& localPlayerId, std::chrono::milliseconds offset) override;
65  bool adjustSeek(const std::string& localPlayerId, std::chrono::milliseconds deltaOffset) override;
67  std::vector<acsdkExternalMediaPlayerInterfaces::AdapterState> getAdapterStates() override;
68  std::chrono::milliseconds getOffset(const std::string& localPlayerId) override;
69  void setExternalMediaPlayer(const std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface>
70  externalMediaPlayer) override;
72 
73 private:
81  std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface> getAdapterByLocalPlayerId(
82  const std::string& localPlayerId);
83 
85  std::unordered_map<std::string, std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface>>
86  m_adapters;
87 
89  std::mutex m_adaptersMutex;
90 };
91 
92 } // namespace acsdkExternalMediaPlayer
93 } // namespace alexaClientSDK
94 #endif // ALEXA_CLIENT_SDK_ACSDKEXTERNALMEDIAPLAYER_INCLUDE_ACSDKEXTERNALMEDIAPLAYER_STATICEXTERNALMEDIAPLAYERADAPTERHANDLER_H_
RequestType
Definition: ExternalMediaAdapterInterface.h:32
::std::string string
Definition: gtest-port.h:1097
bool playControl(const std::string &localPlayerId, acsdkExternalMediaPlayerInterfaces::RequestType requestType, const std::string &playbackTarget) override
bool seek(const std::string &localPlayerId, std::chrono::milliseconds offset) override
Definition: StaticExternalMediaPlayerAdapterHandler.h:26
bool login(const std::string &localPlayerId, const std::string &accessToken, const std::string &userName, bool forceLogin, std::chrono::milliseconds tokenRefreshInterval) override
std::vector< acsdkExternalMediaPlayerInterfaces::AdapterState > getAdapterStates() override
Definition: ExternalMediaAdapterInterface.h:495
virtual void doShutdown() override
alexaClientSDK::avsCommon::utils::RequiresShutdown
PlayParams is a struct that contains the parameters for the play method.
Definition: ExternalMediaAdapterHandlerInterface.h:61
std::chrono::milliseconds getOffset(const std::string &localPlayerId) override
std::vector< acsdkExternalMediaPlayerInterfaces::PlayerInfo > updatePlayerInfo(const std::vector< acsdkExternalMediaPlayerInterfaces::PlayerInfo > &playerList) override
bool adjustSeek(const std::string &localPlayerId, std::chrono::milliseconds deltaOffset) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void addAdapter(const std::string &localPlayerId, std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface > adapter)
acsdkExternalMediaPlayerInterfaces::AdapterState getAdapterState(const std::string &localPlayerId) override
void setExternalMediaPlayer(const std::shared_ptr< acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface > externalMediaPlayer) override

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