AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
BlockingPolicy.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_BLOCKINGPOLICY_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_BLOCKINGPOLICY_H_
18 
19 #include <bitset>
20 #include <iostream>
21 
23 
24 namespace alexaClientSDK {
25 namespace avsCommon {
26 namespace avs {
32 public:
36  struct Medium {
38  enum MediumEnum {
45  };
46  };
47 
49  using Mediums = std::bitset<Medium::COUNT>;
50 
53 
56 
59 
65 
72  BlockingPolicy(const Mediums& mediums = MEDIUMS_NONE, bool isBlocking = true);
73 
79  bool isValid() const;
80 
85  bool isBlocking() const;
86 
92  Mediums getMediums() const;
93 
94 private:
96  Mediums m_mediums;
97 
99  bool m_isBlocking;
100 };
101 
109 inline std::ostream& operator<<(std::ostream& stream, const BlockingPolicy& policy) {
110  stream << " Mediums:";
111  auto mediums = policy.getMediums();
112  if (BlockingPolicy::MEDIUM_AUDIO == mediums) {
113  stream << "MEDIUM_AUDIO";
114  } else if (BlockingPolicy::MEDIUM_VISUAL == mediums) {
115  stream << "MEDIUM_VISUAL";
116  } else if (BlockingPolicy::MEDIUMS_AUDIO_AND_VISUAL == mediums) {
117  stream << "MEDIUMS_AUDIO_AND_VISUAL";
118  } else if (BlockingPolicy::MEDIUMS_NONE == mediums) {
119  stream << "MEDIUMS_NONE";
120  } else {
121  stream << "Unknown";
122  }
123 
124  stream << policy.getMediums() << " .isBlocking:" << (policy.isBlocking() ? "True" : "False");
125 
126  return stream;
127 }
128 
136 bool operator==(const BlockingPolicy& lhs, const BlockingPolicy& rhs);
137 
145 bool operator!=(const BlockingPolicy& lhs, const BlockingPolicy& rhs);
146 
147 } // namespace avs
148 } // namespace avsCommon
149 } // namespace alexaClientSDK
150 
151 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_BLOCKINGPOLICY_H_
static const avscommon_EXPORT Mediums MEDIUM_AUDIO
Policy uses AUDIO medium.
Definition: BlockingPolicy.h:52
std::bitset< Medium::COUNT > Mediums
The mediums used by the policy owner.
Definition: BlockingPolicy.h:49
bool operator==(const BlockingPolicy &lhs, const BlockingPolicy &rhs)
Visual Medium.
Definition: BlockingPolicy.h:42
bool operator!=(const BlockingPolicy &lhs, const BlockingPolicy &rhs)
MediumEnum
The medium enum.
Definition: BlockingPolicy.h:38
Number of mediums. This MUST be the last enum member.
Definition: BlockingPolicy.h:44
static const avscommon_EXPORT Mediums MEDIUMS_AUDIO_AND_VISUAL
Policy uses AUDIO and VISUAL mediums.
Definition: BlockingPolicy.h:58
BlockingPolicy(const Mediums &mediums=MEDIUMS_NONE, bool isBlocking=true)
static const avscommon_EXPORT Mediums MEDIUM_VISUAL
Policy uses VISUAL medium.
Definition: BlockingPolicy.h:55
std::ostream & operator<<(std::ostream &stream, AlexaResponseType responseType)
Definition: AlexaResponseType.h:93
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Audio Medium.
Definition: BlockingPolicy.h:40
Definition: BlockingPolicy.h:31
static const avscommon_EXPORT Mediums MEDIUMS_NONE
Definition: BlockingPolicy.h:64
#define avscommon_EXPORT
Definition: PlatformDefinitions.h:39

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