16 #ifndef ALEXA_CLIENT_SDK_ACSDKALERTS_INCLUDE_ACSDKALERTS_ALERTSCAPABILITYAGENT_H_ 17 #define ALEXA_CLIENT_SDK_ACSDKALERTS_INCLUDE_ACSDKALERTS_ALERTSCAPABILITYAGENT_H_ 22 #include <unordered_set> 58 namespace acsdkAlerts {
76 ,
public std::enable_shared_from_this<AlertsCapabilityAgent> {
103 const std::shared_ptr<acsdkAlerts::renderer::Renderer>& alertRenderer,
104 const std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface>& shutdownNotifier,
105 const std::shared_ptr<avsCommon::sdkInterfaces::AVSConnectionManagerInterface>& connectionManager,
106 const std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface>& contextManager,
107 const std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface>&
108 exceptionEncounteredSender,
112 const std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface>& messageSender,
113 const std::shared_ptr<avsCommon::sdkInterfaces::SpeakerManagerInterface>& speakerManager,
114 const std::shared_ptr<avsCommon::sdkInterfaces::audio::AudioFactoryInterface>& audioFactory,
118 const std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>&
metricRecorder,
119 const std::shared_ptr<acsdkSystemClockMonitorInterfaces::SystemClockNotifierInterface>& systemClockMonitor,
120 const std::shared_ptr<certifiedSender::CertifiedSender>& certifiedSender,
121 const std::shared_ptr<registrationManager::CustomerDataManagerInterface>& dataManager,
122 const std::shared_ptr<settings::DeviceSettingsManager>& settingsManager,
123 const std::shared_ptr<storage::AlertStorageInterface>& alertStorage,
124 bool startAlertSchedulingOnInitialization =
true);
149 static std::shared_ptr<AlertsCapabilityAgent>
create(
150 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
151 std::shared_ptr<avsCommon::sdkInterfaces::AVSConnectionManagerInterface> connectionManager,
152 std::shared_ptr<certifiedSender::CertifiedSender> certifiedMessageSender,
153 std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> focusManager,
154 std::shared_ptr<avsCommon::sdkInterfaces::SpeakerManagerInterface> speakerManager,
155 std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
156 std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender,
157 std::shared_ptr<storage::AlertStorageInterface> alertStorage,
158 std::shared_ptr<avsCommon::sdkInterfaces::audio::AlertsAudioFactoryInterface> alertsAudioFactory,
159 std::shared_ptr<renderer::RendererInterface> alertRenderer,
160 std::shared_ptr<registrationManager::CustomerDataManagerInterface> dataManager,
161 std::shared_ptr<settings::AlarmVolumeRampSetting> alarmVolumeRampSetting,
162 std::shared_ptr<settings::DeviceSettingsManager> settingsManager,
163 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> metricRecorder =
nullptr,
164 bool startAlertSchedulingOnInitialization =
true,
165 std::shared_ptr<acsdkSystemClockMonitorInterfaces::SystemClockNotifierInterface> systemClockMonitor =
nullptr);
224 void addObserver(std::shared_ptr<acsdkAlertsInterfaces::AlertObserverInterface> observer)
override;
225 void removeObserver(std::shared_ptr<acsdkAlertsInterfaces::AlertObserverInterface> observer)
override;
265 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
266 std::shared_ptr<certifiedSender::CertifiedSender> certifiedMessageSender,
267 std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> focusManager,
268 std::shared_ptr<avsCommon::sdkInterfaces::SpeakerManagerInterface> speakerManager,
269 std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
270 std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender,
271 std::shared_ptr<storage::AlertStorageInterface> alertStorage,
272 std::shared_ptr<avsCommon::sdkInterfaces::audio::AlertsAudioFactoryInterface> alertsAudioFactory,
273 std::shared_ptr<renderer::RendererInterface> alertRenderer,
274 std::shared_ptr<registrationManager::CustomerDataManagerInterface> dataManager,
275 std::shared_ptr<settings::AlarmVolumeRampSetting> alarmVolumeRampSetting,
276 std::shared_ptr<settings::DeviceSettingsManager> settingsManager,
277 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> metricRecorder,
278 std::shared_ptr<acsdkSystemClockMonitorInterfaces::SystemClockNotifierInterface> systemClockMonitor);
280 void doShutdown()
override;
289 bool initialize(
bool startAlertSchedulingOnInitialization =
true);
298 bool initializeAlerts(
bool startAlertSchedulingOnInitialization =
true);
317 void executeHandleDirectiveImmediately(std::shared_ptr<DirectiveInfo> info);
331 void executeOnSpeakerSettingsChanged(
347 void executeAddObserver(std::shared_ptr<acsdkAlertsInterfaces::AlertObserverInterface> observer);
354 void executeRemoveObserver(std::shared_ptr<acsdkAlertsInterfaces::AlertObserverInterface> observer);
366 void executeRemoveAllAlerts();
371 void executeOnLocalStop();
383 const std::shared_ptr<avsCommon::avs::AVSDirective>& directive,
384 const rapidjson::Document& payload,
396 bool handleDeleteAlert(
397 const std::shared_ptr<avsCommon::avs::AVSDirective>& directive,
398 const rapidjson::Document& payload,
408 bool handleDeleteAlerts(
409 const std::shared_ptr<avsCommon::avs::AVSDirective>& directive,
410 const rapidjson::Document& payload);
419 bool handleSetVolume(
420 const std::shared_ptr<avsCommon::avs::AVSDirective>& directive,
421 const rapidjson::Document& payload);
430 bool handleAdjustVolume(
431 const std::shared_ptr<avsCommon::avs::AVSDirective>& directive,
432 const rapidjson::Document& payload);
441 bool handleSetAlarmVolumeRamp(
442 const std::shared_ptr<avsCommon::avs::AVSDirective>& directive,
443 const rapidjson::Document& payload);
459 bool isCertified =
false,
472 void sendBulkEvent(
const std::string& eventName,
const std::list<std::string>& tokenList,
bool isCertified =
false);
480 void updateAVSWithLocalVolumeChanges(int8_t volume,
bool forceUpdate);
488 void sendProcessingDirectiveException(
489 const std::shared_ptr<avsCommon::avs::AVSDirective>& directive,
495 void acquireChannel();
500 void releaseChannel();
505 void updateContextManager();
536 void setNextAlertVolume(int64_t volume);
553 void submitAlertCanceledMetricWithMetadata(
567 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> m_metricRecorder;
569 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> m_messageSender;
571 std::shared_ptr<certifiedSender::CertifiedSender> m_certifiedSender;
573 std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> m_focusManager;
575 std::shared_ptr<avsCommon::sdkInterfaces::SpeakerManagerInterface> m_speakerManager;
577 std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> m_contextManager;
580 std::unordered_set<std::shared_ptr<acsdkAlertsInterfaces::AlertObserverInterface>> m_observers;
591 std::shared_ptr<avsCommon::sdkInterfaces::audio::AlertsAudioFactoryInterface> m_alertsAudioFactory;
594 std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> m_capabilityConfigurations;
600 bool m_contentChannelIsActive;
603 bool m_commsChannelIsActive;
606 bool m_alertIsSounding;
609 std::clock_t m_startSystemClock;
622 std::shared_ptr<settings::AlarmVolumeRampSetting> m_alarmVolumeRampSetting;
625 std::shared_ptr<settings::DeviceSettingsManager> m_settingsManager;
628 std::shared_ptr<acsdkSystemClockMonitorInterfaces::SystemClockNotifierInterface> m_systemClockMonitor;
634 #endif // ALEXA_CLIENT_SDK_ACSDKALERTS_INCLUDE_ACSDKALERTS_ALERTSCAPABILITYAGENT_H_ Definition: AudioFocusAnnotation.h:25
static std::shared_ptr< AlertsCapabilityAgentInterface > createAlertsCapabilityAgent(const std::shared_ptr< acsdkAlerts::renderer::Renderer > &alertRenderer, const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier, const std::shared_ptr< avsCommon::sdkInterfaces::AVSConnectionManagerInterface > &connectionManager, const std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > &contextManager, const std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > &exceptionEncounteredSender, const acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, avsCommon::sdkInterfaces::FocusManagerInterface > &audioFocusManager, const std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > &messageSender, const std::shared_ptr< avsCommon::sdkInterfaces::SpeakerManagerInterface > &speakerManager, const std::shared_ptr< avsCommon::sdkInterfaces::audio::AudioFactoryInterface > &audioFactory, const acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > &endpointCapabilitiesRegistrar, const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder, const std::shared_ptr< acsdkSystemClockMonitorInterfaces::SystemClockNotifierInterface > &systemClockMonitor, const std::shared_ptr< certifiedSender::CertifiedSender > &certifiedSender, const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &dataManager, const std::shared_ptr< settings::DeviceSettingsManager > &settingsManager, const std::shared_ptr< storage::AlertStorageInterface > &alertStorage, bool startAlertSchedulingOnInitialization=true)
Definition: CapabilityAgent.h:47
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration() const override
MixingBehavior
Definition: MixingBehavior.h:25
void cancelDirective(std::shared_ptr< DirectiveInfo > info) override
void onAlertStateChange(const AlertInfo &alertInfo) override
void onFocusChanged(avsCommon::avs::FocusState focusState, avsCommon::avs::MixingBehavior behavior) override
Definition: CapabilityConfigurationInterface.h:32
ChangedReason
Definition: ConnectionStatusObserverInterface.h:50
void removeAllAlerts() override
An interface that clients can extend to register to observe focus changes.
Definition: FocusManagerObserverInterface.h:26
::std::string string
Definition: gtest-port.h:1097
void addObserver(std::shared_ptr< acsdkAlertsInterfaces::AlertObserverInterface > observer) override
Single-thread executor implementation.
Definition: Executor.h:45
Definition: EndpointCapabilitiesRegistrarInterface.h:35
Type
Definition: ChannelVolumeInterface.h:37
Definition: ConnectionStatusObserverInterface.h:31
Definition: AlertObserverInterface.h:31
void onSpeakerSettingsChanged(const Source &source, const avsCommon::sdkInterfaces::ChannelVolumeInterface::Type &type, const avsCommon::sdkInterfaces::SpeakerInterface::SpeakerSettings &settings) override
Definition: RequiresShutdown.h:32
std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations() override
FocusState
Definition: FocusState.h:29
Definition: FocusManagerInterface.h:54
static settings::SettingEventMetadata getAlarmVolumeRampMetadata()
static std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder
Metric recorder shared ptr.
Definition: BaseAPLCapabilityAgentTest.cpp:261
void clearData() override
Definition: DefaultEndpointAnnotation.h:26
Definition: AlertObserverInterface.h:171
Definition: AlertsCapabilityAgent.h:65
void onSystemClockSynchronized() override
Definition: Annotated.h:35
std::unordered_map< directiveRoutingRule::DirectiveRoutingRule, BlockingPolicy > DirectiveHandlerConfiguration
Definition: DirectiveHandlerConfiguration.h:32
Definition: SpeakerManagerObserverInterface.h:32
static std::shared_ptr< AlertsCapabilityAgent > create(std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::AVSConnectionManagerInterface > connectionManager, std::shared_ptr< certifiedSender::CertifiedSender > certifiedMessageSender, std::shared_ptr< avsCommon::sdkInterfaces::FocusManagerInterface > focusManager, std::shared_ptr< avsCommon::sdkInterfaces::SpeakerManagerInterface > speakerManager, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender, std::shared_ptr< storage::AlertStorageInterface > alertStorage, std::shared_ptr< avsCommon::sdkInterfaces::audio::AlertsAudioFactoryInterface > alertsAudioFactory, std::shared_ptr< renderer::RendererInterface > alertRenderer, std::shared_ptr< registrationManager::CustomerDataManagerInterface > dataManager, std::shared_ptr< settings::AlarmVolumeRampSetting > alarmVolumeRampSetting, std::shared_ptr< settings::DeviceSettingsManager > settingsManager, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder=nullptr, bool startAlertSchedulingOnInitialization=true, std::shared_ptr< acsdkSystemClockMonitorInterfaces::SystemClockNotifierInterface > systemClockMonitor=nullptr)
void handleDirective(std::shared_ptr< DirectiveInfo > info) override
Definition: SpeakerInterface.h:42
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Definition: AlertsCapabilityAgentInterface.h:27
void onDeregistered() override
void removeObserver(std::shared_ptr< acsdkAlertsInterfaces::AlertObserverInterface > observer) override
void onLocalStop() override
void onConnectionStatusChanged(const Status status, const ChangedReason reason) override
void preHandleDirective(std::shared_ptr< DirectiveInfo > info) override
type
Definition: upload.py:443
Definition: SystemClockMonitorObserverInterface.h:25
Source
Indicates whether the source of the call is from an AVS Directive or through a Local API call...
Definition: SpeakerManagerObserverInterface.h:35
static const std::chrono::minutes ALERT_PAST_DUE_CUTOFF_MINUTES
Definition: AlertsCapabilityAgent.h:60
Definition: CustomerDataHandler.h:34
Status
Definition: ConnectionStatusObserverInterface.h:36
void handleDirectiveImmediately(std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
Definition: AlertScheduler.h:38