AlexaClientSDK  1.25.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PlaybackButtons.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_AVS_INCLUDE_AVSCOMMON_AVS_PLAYBACKBUTTONS_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_PLAYBACKBUTTONS_H_
18 
19 #include <iostream>
20 
21 namespace alexaClientSDK {
22 namespace avsCommon {
23 namespace avs {
24 
26 enum class PlaybackButton {
28  PLAY,
29 
31  PAUSE,
32 
34  NEXT,
35 
37  PREVIOUS,
38 
39  // Playback Controller 'Skip Forward' button.
41 
42  // Playback Controller 'Skip Backward' button.
44 };
45 
46 enum class PlaybackToggle {
47  // Playback Controller 'Shuffle' toggle.
48  SHUFFLE,
49 
50  // Playback Controller 'Loop' toggle.
51  LOOP,
52 
53  // Playback Controller 'Repeat' toggle.
54  REPEAT,
55 
56  // Playback Controller 'Thumbs Up' toggle.
57  THUMBS_UP,
58 
59  // Playback Controller 'Thumbs Down' toggle.
61 };
62 
69 inline std::string PlaybackButtonToString(PlaybackButton button) {
70  switch (button) {
72  return "Play";
74  return "Pause";
76  return "Previous";
78  return "Next";
80  return "Skip_Forward";
82  return "Skip_Backward";
83  }
84 
85  return "unknown playbackButton";
86 }
87 
94 inline std::string PlaybackToggleToString(PlaybackToggle toggle) {
95  switch (toggle) {
97  return "Shuffle";
99  return "Loop";
101  return "Repeat";
103  return "Thumbs_Up";
105  return "Thumbs_Down";
106  }
107 
108  return "unknown playbackToggle";
109 }
110 
117 #define ACSDK_PLAYBACK_BUTTON_TO_STRING(button) \
118  case PlaybackButton::button: { \
119  return stream << #button; \
120  }
121 
128 #define ACSDK_PLAYBACK_TOGGLE_TO_STRING(toggle) \
129  case PlaybackToggle::toggle: { \
130  return stream << #toggle; \
131  }
132 
140 inline std::ostream& operator<<(std::ostream& stream, const PlaybackButton& button) {
141  switch (button) {
147  ACSDK_PLAYBACK_BUTTON_TO_STRING(SKIP_BACKWARD);
148  }
149 
150  return stream;
151 }
152 
153 #undef ACSDK_PLAYBACK_BUTTON_TO_STRING
154 
162 inline std::ostream& operator<<(std::ostream& stream, const PlaybackToggle& toggle) {
163  switch (toggle) {
168  ACSDK_PLAYBACK_TOGGLE_TO_STRING(THUMBS_DOWN);
169  }
170 
171  return stream;
172 }
173 
174 #undef ACSDK_PLAYBACK_TOGGLE_TO_STRING
175 
176 } // namespace avs
177 } // namespace avsCommon
178 } // namespace alexaClientSDK
179 
180 namespace std {
184 template <>
186  inline size_t operator()(const alexaClientSDK::avsCommon::avs::PlaybackButton& button) const {
187  return std::hash<std::string>{}(PlaybackButtonToString(button));
188  }
189 };
193 template <>
195  inline size_t operator()(const alexaClientSDK::avsCommon::avs::PlaybackToggle& toggle) const {
196  return std::hash<std::string>{}(PlaybackToggleToString(toggle));
197  }
198 };
199 
200 } // namespace std
201 
202 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_PLAYBACKBUTTONS_H_
#define ACSDK_PLAYBACK_TOGGLE_TO_STRING(toggle)
Definition: PlaybackButtons.h:128
Playback Controller &#39;Pause&#39; button.
size_t operator()(const alexaClientSDK::avsCommon::avs::PlaybackButton &button) const
Definition: PlaybackButtons.h:186
Definition: CapabilityConfiguration.h:190
PlaybackButton
Enumeration class for supported playback buttons.
Definition: PlaybackButtons.h:26
Playback Controller &#39;Play&#39; button.
std::ostream & operator<<(std::ostream &stream, AlexaResponseType responseType)
Definition: AlexaResponseType.h:93
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Playback Controller &#39;Previous&#39; button.
Playback Controller &#39;Next&#39; button.
std::string PlaybackToggleToString(PlaybackToggle toggle)
Definition: PlaybackButtons.h:94
PlaybackToggle
Definition: PlaybackButtons.h:46
std::string PlaybackButtonToString(PlaybackButton button)
Definition: PlaybackButtons.h:69
size_t operator()(const alexaClientSDK::avsCommon::avs::PlaybackToggle &toggle) const
Definition: PlaybackButtons.h:195
#define ACSDK_PLAYBACK_BUTTON_TO_STRING(button)
Definition: PlaybackButtons.h:117

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