16 #ifndef ALEXA_CLIENT_SDK_CAPABILITYAGENTS_SYSTEM_INCLUDE_SYSTEM_USERINACTIVITYMONITOR_H_ 17 #define ALEXA_CLIENT_SDK_CAPABILITYAGENTS_SYSTEM_INCLUDE_SYSTEM_USERINACTIVITYMONITOR_H_ 35 namespace capabilityAgents {
56 static std::shared_ptr<avsCommon::sdkInterfaces::UserInactivityMonitorInterface>
58 const std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface>& messageSender,
59 const std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface>&
60 exceptionEncounteredSender,
61 const std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface>& shutdownNotifier,
62 const std::shared_ptr<avsCommon::sdkInterfaces::DirectiveSequencerInterface>& directiveSequencer,
63 const std::chrono::milliseconds& sendPeriod = std::chrono::hours(1));
75 static std::shared_ptr<UserInactivityMonitor>
create(
76 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
77 std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender,
78 const std::chrono::milliseconds& sendPeriod = std::chrono::hours(1));
84 void preHandleDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info)
override;
85 void handleDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info)
override;
86 void cancelDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info)
override;
94 std::shared_ptr<avsCommon::sdkInterfaces::UserInactivityMonitorObserverInterface> observer)
override;
96 std::shared_ptr<avsCommon::sdkInterfaces::UserInactivityMonitorObserverInterface> observer)
override;
108 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
109 std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender,
110 const std::chrono::milliseconds& sendPeriod);
114 void doShutdown()
override;
124 void removeDirectiveGracefully(
125 std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info,
126 bool isFailure =
false,
130 void sendInactivityReport();
138 void notifyObservers();
141 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> m_messageSender;
153 std::atomic_bool m_recentUpdateBlocked;
159 std::chrono::time_point<std::chrono::steady_clock> m_lastTimeActive;
162 std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::UserInactivityMonitorObserverInterface>>
163 m_inactivityObservers;
166 const std::chrono::milliseconds m_sendPeriod;
173 #endif // ALEXA_CLIENT_SDK_CAPABILITYAGENTS_SYSTEM_INCLUDE_SYSTEM_USERINACTIVITYMONITOR_H_ void removeObserver(std::shared_ptr< avsCommon::sdkInterfaces::UserInactivityMonitorObserverInterface > observer) override
Definition: CapabilityAgent.h:47
void onUserActive() override
The function to be called when the user has become active.
void preHandleDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
void addObserver(std::shared_ptr< avsCommon::sdkInterfaces::UserInactivityMonitorObserverInterface > observer) override
::std::string string
Definition: gtest-port.h:1097
Definition: RequiresShutdown.h:32
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration() const override
void handleDirectiveImmediately(std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
Definition: UserInactivityMonitorInterface.h:36
void cancelDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
void handleDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
std::unordered_map< directiveRoutingRule::DirectiveRoutingRule, BlockingPolicy > DirectiveHandlerConfiguration
Definition: DirectiveHandlerConfiguration.h:32
Timer to schedule task for delayed and periodic execution.
Definition: Timer.h:39
static std::shared_ptr< UserInactivityMonitor > create(std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender, const std::chrono::milliseconds &sendPeriod=std::chrono::hours(1))
std::chrono::seconds timeSinceUserActivity() override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static std::shared_ptr< avsCommon::sdkInterfaces::UserInactivityMonitorInterface > createUserInactivityMonitorInterface(const std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > &messageSender, const std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > &exceptionEncounteredSender, const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier, const std::shared_ptr< avsCommon::sdkInterfaces::DirectiveSequencerInterface > &directiveSequencer, const std::chrono::milliseconds &sendPeriod=std::chrono::hours(1))
This class implements a CapabilityAgent that handles the SetEndpoint directive.
Definition: UserInactivityMonitor.h:39