16 #ifndef ACSDKDONOTDISTURB_DONOTDISTURBCAPABILITYAGENT_H_ 17 #define ACSDKDONOTDISTURB_DONOTDISTURBCAPABILITYAGENT_H_ 23 #include <rapidjson/document.h> 47 namespace capabilityAgents {
48 namespace doNotDisturb {
58 :
public std::enable_shared_from_this<DoNotDisturbCapabilityAgent>
84 const std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface>& messageSender,
85 const std::shared_ptr<alexaClientSDK::settings::storage::DeviceSettingStorageInterface>& settingsStorage,
86 const std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface>&
88 const std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface>& shutdownNotifier,
92 endpointCapabilitiesRegistrar,
93 const std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::AVSConnectionManagerInterface>&
95 const std::shared_ptr<alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface>&
metricRecorder);
106 static std::shared_ptr<DoNotDisturbCapabilityAgent>
create(
107 std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface>
108 exceptionEncounteredSender,
109 std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
110 std::shared_ptr<settings::storage::DeviceSettingStorageInterface> settingsStorage);
117 std::shared_ptr<alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo> info)
override;
118 void handleDirective(std::shared_ptr<alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo> info)
override;
119 void cancelDirective(std::shared_ptr<alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo> info)
override;
124 std::unordered_set<std::shared_ptr<alexaClientSDK::avsCommon::avs::CapabilityConfiguration>>
169 std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface>
170 exceptionEncounteredSender,
171 std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
172 std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::AVSConnectionManagerInterface> connectionManager);
184 static std::shared_ptr<DoNotDisturbCapabilityAgent>
create(
185 const std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface>& messageSender,
186 const std::shared_ptr<alexaClientSDK::settings::storage::DeviceSettingStorageInterface>& settingsStorage,
187 const std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface>&
189 const std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::AVSConnectionManagerInterface>&
190 connectionManager =
nullptr,
191 const std::shared_ptr<alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface>& metricRecorder =
201 std::shared_ptr<settings::storage::DeviceSettingStorageInterface> settingsStorage,
202 const std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>& metricRecorder);
211 std::shared_future<alexaClientSDK::avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status> sendDNDEvent(
218 void generateCapabilityConfiguration();
228 bool handleSetDoNotDisturbDirective(
229 std::shared_ptr<alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo> info,
230 rapidjson::Document& document);
233 std::unordered_set<std::shared_ptr<alexaClientSDK::avsCommon::avs::CapabilityConfiguration>>
234 m_capabilityConfigurations;
237 std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface> m_messageSender;
241 std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::AVSConnectionManagerInterface> m_connectionManager;
244 std::shared_ptr<alexaClientSDK::settings::Setting<bool>> m_dndModeSetting;
253 std::mutex m_connectedStateMutex;
256 std::atomic_bool m_hasOfflineChanges;
266 #endif // ACSDKDONOTDISTURB_DONOTDISTURBCAPABILITYAGENT_H_ std::shared_future< bool > sendChangedEvent(const std::string &value) override
Definition: CapabilityAgent.h:47
static std::shared_ptr< DoNotDisturbCapabilityAgent > createDoNotDisturbCapabilityAgent(const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface > &messageSender, const std::shared_ptr< alexaClientSDK::settings::storage::DeviceSettingStorageInterface > &settingsStorage, const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > &exceptionSender, const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier, const acsdkManufactory::Annotated< alexaClientSDK::avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > &endpointCapabilitiesRegistrar, const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::AVSConnectionManagerInterface > &connectionManager, const std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder)
Definition: CapabilityConfigurationInterface.h:32
ChangedReason
Definition: ConnectionStatusObserverInterface.h:50
void handleDirective(std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
void onConnectionStatusChanged(const Status status, const ChangedReason reason) override
::std::string string
Definition: gtest-port.h:1097
~DoNotDisturbCapabilityAgent() override=default
Single-thread executor implementation.
Definition: Executor.h:45
Definition: EndpointCapabilitiesRegistrarInterface.h:35
Definition: ConnectionStatusObserverInterface.h:31
Definition: DoNotDisturbCapabilityAgent.h:57
Definition: RequiresShutdown.h:32
void doShutdown() override
void preHandleDirective(std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
std::unordered_set< std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations() override
static settings::SettingEventMetadata getDoNotDisturbEventsMetadata()
static std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder
Metric recorder shared ptr.
Definition: BaseAPLCapabilityAgentTest.cpp:261
Definition: DefaultEndpointAnnotation.h:26
Definition: Annotated.h:35
std::unordered_map< directiveRoutingRule::DirectiveRoutingRule, BlockingPolicy > DirectiveHandlerConfiguration
Definition: DirectiveHandlerConfiguration.h:32
std::shared_ptr< settings::DoNotDisturbSetting > getDoNotDisturbSetting() const
Definition: SettingEventSenderInterface.h:29
void handleDirectiveImmediately(std::shared_ptr< alexaClientSDK::avsCommon::avs::AVSDirective > directive) override
static std::shared_ptr< DoNotDisturbCapabilityAgent > create(std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender, std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< settings::storage::DeviceSettingStorageInterface > settingsStorage)
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::shared_future< bool > sendReportEvent(const std::string &value) override
alexaClientSDK::avsCommon::avs::DirectiveHandlerConfiguration getConfiguration() const override
Status
Definition: ConnectionStatusObserverInterface.h:36
void cancelDirective(std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
std::shared_future< bool > sendStateReportEvent(const std::string &payload) override