AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
AudioActivityTracker.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_AFML_INCLUDE_AFML_AUDIOACTIVITYTRACKER_H_
17 #define ALEXA_CLIENT_SDK_AFML_INCLUDE_AFML_AUDIOACTIVITYTRACKER_H_
18 
19 #include <chrono>
20 #include <memory>
21 #include <string>
22 #include <unordered_map>
23 #include <vector>
24 
36 
37 #include "AFML/Channel.h"
39 
40 namespace alexaClientSDK {
41 namespace afml {
42 
53 public:
66  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
67  std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface> shutdownNotifier,
71  defaultEndpointCapabilitiesRegistrar);
72 
79  static std::shared_ptr<AudioActivityTracker> create(
80  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager);
81 
84  void provideState(const avsCommon::avs::NamespaceAndName& stateProviderName, unsigned int stateRequestToken)
85  override;
87 
90  void notifyOfActivityUpdates(const std::vector<Channel::State>& channelStates) override;
92 
95  std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> getCapabilityConfigurations() override;
97 
98 private:
104  AudioActivityTracker(std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager);
105 
108  void doShutdown() override;
110 
117  void executeNotifyOfActivityUpdates(const std::vector<Channel::State>& channelStates);
118 
126  void executeProvideState(unsigned int stateRequestToken);
127 
134  const std::string& executeChannelNameInLowerCase(const std::string& channelName);
135 
137  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> m_contextManager;
138 
145  std::unordered_map<std::string, Channel::State> m_channelStates;
149 
152  std::unordered_map<std::string, std::string> m_channelNamesInLowerCase;
154 
156  std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> m_capabilityConfigurations;
157 
165 };
166 
167 } // namespace afml
168 } // namespace alexaClientSDK
169 
170 #endif // ALEXA_CLIENT_SDK_AFML_INCLUDE_AFML_AUDIOACTIVITYTRACKER_H_
static acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, ActivityTrackerInterface > createAudioActivityTrackerInterface(std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > shutdownNotifier, acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > defaultEndpointCapabilitiesRegistrar)
Definition: NamespaceAndName.h:32
Definition: AudioActivityTracker.h:48
::std::string string
Definition: gtest-port.h:1097
Definition: ActivityTrackerInterface.h:31
Single-thread executor implementation.
Definition: Executor.h:45
std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations() override
void notifyOfActivityUpdates(const std::vector< Channel::State > &channelStates) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static std::shared_ptr< AudioActivityTracker > create(std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager)
void provideState(const avsCommon::avs::NamespaceAndName &stateProviderName, unsigned int stateRequestToken) 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