16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_FOCUSMANAGERINTERFACE_H_ 17 #define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_FOCUSMANAGERINTERFACE_H_ 31 namespace sdkInterfaces {
74 static std::shared_ptr<Activity>
create(
76 const std::shared_ptr<avsCommon::sdkInterfaces::ChannelObserverInterface>& channelObserver,
77 const std::chrono::milliseconds& patienceDuration = std::chrono::milliseconds::zero(),
81 return this->m_interface == rhs.m_interface;
126 std::shared_ptr<avsCommon::sdkInterfaces::ChannelObserverInterface>
getChannelObserver()
const;
146 const std::chrono::milliseconds& patienceDuration,
147 const std::shared_ptr<avsCommon::sdkInterfaces::ChannelObserverInterface>& channelObserver,
149 m_interface{interfaceName},
150 m_patienceDuration{patienceDuration},
151 m_channelObserver{channelObserver},
152 m_contentType{contentType},
164 mutable std::mutex m_mutex;
170 const std::chrono::milliseconds m_patienceDuration;
173 const std::shared_ptr<avsCommon::sdkInterfaces::ChannelObserverInterface> m_channelObserver;
230 std::shared_ptr<avsCommon::sdkInterfaces::ChannelObserverInterface> channelObserver,
245 std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface::Activity> channelActivity) = 0;
259 std::shared_ptr<avsCommon::sdkInterfaces::ChannelObserverInterface> channelObserver) = 0;
281 const std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerObserverInterface>& observer) = 0;
289 const std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerObserverInterface>& observer) = 0;
308 const std::shared_ptr<avsCommon::sdkInterfaces::ChannelObserverInterface>& channelObserver,
309 const std::chrono::milliseconds& patienceDuration,
311 if (interfaceName.empty() || patienceDuration.count() < 0 || channelObserver ==
nullptr) {
315 auto activity = std::shared_ptr<FocusManagerInterface::Activity>(
325 return m_patienceDuration;
329 std::unique_lock<std::mutex> lock(m_mutex);
330 return m_contentType;
334 std::unique_lock<std::mutex> lock(m_mutex);
335 m_contentType = contentType;
339 std::lock_guard<std::mutex> lock(m_mutex);
340 return m_mixingBehavior;
345 return m_channelObserver;
351 if (m_channelObserver) {
359 m_channelObserver->onFocusChanged(focus, overrideBehavior);
361 setMixingBehavior(overrideBehavior);
368 std::unique_lock<std::mutex> lock(m_mutex);
369 m_mixingBehavior = behavior;
376 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_FOCUSMANAGERINTERFACE_H_ virtual bool acquireChannel(const std::string &channelName, std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > channelObserver, const std::string &interfaceName)=0
static constexpr unsigned int VISUAL_CHANNEL_PRIORITY
The default Visual Channel priority.
Definition: FocusManagerInterface.h:210
Definition: FocusManagerInterface.h:64
MixingBehavior
Definition: MixingBehavior.h:25
static constexpr unsigned int ALERT_CHANNEL_PRIORITY
The default Alert Channel priority.
Definition: FocusManagerInterface.h:198
avsCommon::avs::MixingBehavior getMixingBehavior() const
Definition: FocusManagerInterface.h:338
avsCommon::avs::ContentType getContentType() const
Definition: FocusManagerInterface.h:328
::std::string string
Definition: gtest-port.h:1097
static constexpr unsigned int DIALOG_CHANNEL_PRIORITY
The default dialog Channel priority.
Definition: FocusManagerInterface.h:186
static std::shared_ptr< Activity > create(const std::string &interfaceName, const std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > &channelObserver, const std::chrono::milliseconds &patienceDuration=std::chrono::milliseconds::zero(), const avsCommon::avs::ContentType contentType=avsCommon::avs::ContentType::NONMIXABLE)
Definition: FocusManagerInterface.h:306
virtual ~FocusManagerInterface()=default
Destructor.
bool notifyObserver(avs::FocusState focus, avsCommon::avs::MixingBehavior behavior)
Definition: FocusManagerInterface.h:348
virtual void addObserver(const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &observer)=0
Indicates that the corresponding ContentType was undefined/unitialized.
std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > getChannelObserver() const
Definition: FocusManagerInterface.h:344
FocusState
Definition: FocusState.h:29
Definition: FocusManagerInterface.h:54
virtual void stopAllActivities()=0
static constexpr const char * VISUAL_CHANNEL_NAME
The default Visual Channel name.
Definition: FocusManagerInterface.h:207
virtual void removeObserver(const std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerObserverInterface > &observer)=0
static constexpr const char * CONTENT_CHANNEL_NAME
The default Content Channel name.
Definition: FocusManagerInterface.h:201
bool operator==(const Activity &rhs)
Definition: FocusManagerInterface.h:80
virtual void stopForegroundActivity()=0
std::chrono::milliseconds getPatienceDuration() const
Definition: FocusManagerInterface.h:324
static constexpr const char * COMMUNICATIONS_CHANNEL_NAME
The default Communications Channel name.
Definition: FocusManagerInterface.h:189
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static constexpr const char * ALERT_CHANNEL_NAME
The default Alert Channel name.
Definition: FocusManagerInterface.h:195
ContentType
Definition: ContentType.h:25
virtual void modifyContentType(const std::string &channelName, const std::string &interfaceName, avsCommon::avs::ContentType contentType)=0
static constexpr unsigned int CONTENT_CHANNEL_PRIORITY
The default Content Channel priority.
Definition: FocusManagerInterface.h:204
Indicates that the corresponding Activity must pause.
const std::string getInterface() const
Definition: FocusManagerInterface.h:320
static constexpr unsigned int COMMUNICATIONS_CHANNEL_PRIORITY
The default Communications Channel priority.
Definition: FocusManagerInterface.h:192
virtual std::future< bool > releaseChannel(const std::string &channelName, std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > channelObserver)=0
void setContentType(avsCommon::avs::ContentType contentType)
Definition: FocusManagerInterface.h:333
static constexpr const char * DIALOG_CHANNEL_NAME
The default Dialog Channel name.
Definition: FocusManagerInterface.h:183