16 #ifndef ALEXA_CLIENT_SDK_ACSDKALERTS_INCLUDE_ACSDKALERTS_ALERTSCHEDULER_H_ 17 #define ALEXA_CLIENT_SDK_ACSDKALERTS_INCLUDE_ACSDKALERTS_ALERTSCHEDULER_H_ 32 namespace acsdkAlerts {
60 std::shared_ptr<storage::AlertStorageInterface> alertStorage,
61 std::shared_ptr<renderer::RendererInterface> alertRenderer,
62 std::chrono::seconds alertPastDueTimeLimitSeconds,
63 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>
metricRecorder =
nullptr);
82 const std::shared_ptr<acsdkAlertsInterfaces::AlertObserverInterface>& observer,
83 const std::shared_ptr<settings::DeviceSettingsManager>& settingsManager,
84 bool startAlertSchedulingOnInitialization =
true);
124 std::shared_ptr<settings::DeviceSettingsManager> settingsManager,
125 bool shouldScheduleAlerts);
152 bool deleteAlerts(
const std::list<std::string>& tokenList);
229 void executeOnAlertStateChange(
const AlertInfo& alertInfo);
242 const std::shared_ptr<Alert>& alert,
263 void setTimerForNextAlertLocked();
268 void setTimerForNextAlert();
273 void activateNextAlertLocked();
288 bool isAlertActiveLocked(std::shared_ptr<Alert> alert)
const;
296 std::shared_ptr<Alert> getAlertLocked(
const std::string& token)
const;
303 std::shared_ptr<Alert> getActiveAlertLocked()
const;
318 void eraseAlert(std::shared_ptr<Alert> alert);
327 std::shared_ptr<acsdkAlertsInterfaces::AlertObserverInterface> m_observer;
330 std::shared_ptr<settings::DeviceSettingsManager> m_settingsManager;
336 std::shared_ptr<storage::AlertStorageInterface> m_alertStorage;
338 std::shared_ptr<renderer::RendererInterface> m_alertRenderer;
341 std::chrono::seconds m_alertPastDueTimeLimit;
347 std::shared_ptr<Alert> m_activeAlert;
355 bool m_shouldScheduleAlerts;
358 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> m_metricRecorder;
372 #endif // ALEXA_CLIENT_SDK_ACSDKALERTS_INCLUDE_ACSDKALERTS_ALERTSCHEDULER_H_ bool deleteAlerts(const std::list< std::string > &tokenList)
MixingBehavior
Definition: MixingBehavior.h:25
bool snoozeAlert(const std::string &alertToken, const std::string &updatedTime_ISO_8601)
bool deleteAlert(const std::string &alertToken)
avsCommon::avs::FocusState getFocusState()
std::shared_ptr< Alert > getActiveAlert()
StopReason
Definition: Alert.h:84
::std::string string
Definition: gtest-port.h:1097
bool getOfflineStoppedAlerts(rapidjson::Value *alertContainer, rapidjson::Document::AllocatorType &allocator)
void deleteOfflineStoppedAlert(const std::string &token, int id)
Single-thread executor implementation.
Definition: Executor.h:45
Definition: AlertObserverInterface.h:31
void onAlertStateChange(const AlertInfo &alertInfo) override
void clearData(Alert::StopReason reason=Alert::StopReason::SHUTDOWN)
bool initialize(const std::shared_ptr< acsdkAlertsInterfaces::AlertObserverInterface > &observer, const std::shared_ptr< settings::DeviceSettingsManager > &settingsManager, bool startAlertSchedulingOnInitialization=true)
bool reloadAlertsFromDatabase(std::shared_ptr< settings::DeviceSettingsManager > settingsManager, bool shouldScheduleAlerts)
FocusState
Definition: FocusState.h:29
bool scheduleAlert(std::shared_ptr< Alert > alert)
static std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder
Metric recorder shared ptr.
Definition: BaseAPLCapabilityAgentTest.cpp:261
Definition: AlertObserverInterface.h:171
bool Value(const T &value, M matcher)
Definition: gmock-matchers.h:4347
std::vector< Alert::ContextInfo > scheduledAlerts
All alerts that are scheduled.
Definition: AlertScheduler.h:45
Timer to schedule task for delayed and periodic execution.
Definition: Timer.h:39
AlertScheduler::AlertsContextInfo getContextInfo()
bool saveOfflineStoppedAlert(const std::string &alertToken, const std::string &scheduledTime, const std::string &eventTime)
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::vector< Alert::ContextInfo > activeAlerts
All active alerts.
Definition: AlertScheduler.h:47
void updateFocus(avsCommon::avs::FocusState focusState, avsCommon::avs::MixingBehavior behavior)
bool isAlertActive(std::shared_ptr< Alert > alert)
Definition: TimeUtils.h:34
The alert is being stopped due to an SDK shutdown operation.
Definition: AlertScheduler.h:43
AlertScheduler(std::shared_ptr< storage::AlertStorageInterface > alertStorage, std::shared_ptr< renderer::RendererInterface > alertRenderer, std::chrono::seconds alertPastDueTimeLimitSeconds, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder=nullptr)
std::list< std::shared_ptr< Alert > > getAllAlerts()
Definition: AlertScheduler.h:38