![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <AlertScheduler.h>


Classes | |
| struct | AlertsContextInfo |
Public Member Functions | |
| 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) | |
| bool | initialize (const std::shared_ptr< acsdkAlertsInterfaces::AlertObserverInterface > &observer, const std::shared_ptr< settings::DeviceSettingsManager > &settingsManager, bool startAlertSchedulingOnInitialization=true) |
| bool | scheduleAlert (std::shared_ptr< Alert > alert) |
| bool | saveOfflineStoppedAlert (const std::string &alertToken, const std::string &scheduledTime, const std::string &eventTime) |
| bool | getOfflineStoppedAlerts (rapidjson::Value *alertContainer, rapidjson::Document::AllocatorType &allocator) |
| bool | reloadAlertsFromDatabase (std::shared_ptr< settings::DeviceSettingsManager > settingsManager, bool shouldScheduleAlerts) |
| bool | snoozeAlert (const std::string &alertToken, const std::string &updatedTime_ISO_8601) |
| bool | deleteAlert (const std::string &alertToken) |
| bool | deleteAlerts (const std::list< std::string > &tokenList) |
| void | deleteOfflineStoppedAlert (const std::string &token, int id) |
| bool | isAlertActive (std::shared_ptr< Alert > alert) |
| std::shared_ptr< Alert > | getActiveAlert () |
| void | updateFocus (avsCommon::avs::FocusState focusState, avsCommon::avs::MixingBehavior behavior) |
| avsCommon::avs::FocusState | getFocusState () |
| AlertScheduler::AlertsContextInfo | getContextInfo () |
| void | onLocalStop () |
| void | clearData (Alert::StopReason reason=Alert::StopReason::SHUTDOWN) |
| void | shutdown () |
| std::list< std::shared_ptr< Alert > > | getAllAlerts () |
AlertObserverInterface function. | |
| void | onAlertStateChange (const AlertInfo &alertInfo) override |
Public Member Functions inherited from alexaClientSDK::acsdkAlertsInterfaces::AlertObserverInterface | |
| virtual | ~AlertObserverInterface ()=default |
This class handles the management of AVS alerts. This is essentially a time-ordered queue, where a timer is set for the alert which must activate soonest. As alerts are added or removed, this timer must be reset.
| alexaClientSDK::acsdkAlerts::AlertScheduler::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 |
||
| ) |
Constructor.
| alertStorage | The storage object where alerts can be saved, modified and deleted. |
| alertRenderer | The object which will handle user-perceivable effects upon alert activation. |
| alertPastDueTimeLimitSeconds | The threshold in seconds, beyond which alerts will be considered past-due and discarded. |
| metricRecorder | The metric recorder. |
| void alexaClientSDK::acsdkAlerts::AlertScheduler::clearData | ( | Alert::StopReason | reason = Alert::StopReason::SHUTDOWN | ) |
Clear all data being managed. This includes database storage.
| reason | What triggered the data to be cleared. |
| bool alexaClientSDK::acsdkAlerts::AlertScheduler::deleteAlert | ( | const std::string & | alertToken | ) |
Delete an alert from the schedule.
| alertToken | The AVS token identifying the alert. |
| bool alexaClientSDK::acsdkAlerts::AlertScheduler::deleteAlerts | ( | const std::list< std::string > & | tokenList | ) |
Delete multiple alerts from the schedule by their tokens. All existing alerts are deleted with all-or-none rule. In case of failure no actual deletion is made. Missing alert is not treated as an error.
| tokenList | List of tokens of the alerts to be deleted |
| void alexaClientSDK::acsdkAlerts::AlertScheduler::deleteOfflineStoppedAlert | ( | const std::string & | token, |
| int | id | ||
| ) |
Delete an offline stopped alert from list of offline stopped alerts
| token | The alertToken of the alert to be deleted |
| id | The alert Id of the alert to be deleted |
| std::shared_ptr<Alert> alexaClientSDK::acsdkAlerts::AlertScheduler::getActiveAlert | ( | ) |
Gets the current active alert.
| std::list<std::shared_ptr<Alert> > alexaClientSDK::acsdkAlerts::AlertScheduler::getAllAlerts | ( | ) |
Utility method to get list of all alerts being tracked by AlertScheduler
AlertScheduler | AlertScheduler::AlertsContextInfo alexaClientSDK::acsdkAlerts::AlertScheduler::getContextInfo | ( | ) |
Collects Context data for all alerts being managed.
| avsCommon::avs::FocusState alexaClientSDK::acsdkAlerts::AlertScheduler::getFocusState | ( | ) |
Provide our current channel focus state.
| bool alexaClientSDK::acsdkAlerts::AlertScheduler::getOfflineStoppedAlerts | ( | rapidjson::Value * | alertContainer, |
| rapidjson::Document::AllocatorType & | allocator | ||
| ) |
Get list of offline stopped alerts
| alertContainer | rapidJson array to load alerts into |
| allocator | The rapidjson allocator, required for the results of this function to be mergable with other rapidjson::Value objects. |
| bool alexaClientSDK::acsdkAlerts::AlertScheduler::initialize | ( | const std::shared_ptr< acsdkAlertsInterfaces::AlertObserverInterface > & | observer, |
| const std::shared_ptr< settings::DeviceSettingsManager > & | settingsManager, | ||
| bool | startAlertSchedulingOnInitialization = true |
||
| ) |
Initialization.
| observer | An observer which we will notify of all alert state changes. |
| m_settingsManager | A settingsManager object that manages alarm volume ramp setting. |
| startAlertSchedulingOnInitialization | Whether to start scheduling alerts after client initialization. If this is set to false, no alert scheduling will occur until onSystemClockSynchronized is called. |
| bool alexaClientSDK::acsdkAlerts::AlertScheduler::isAlertActive | ( | std::shared_ptr< Alert > | alert | ) |
Utility function to determine if an alert is currently active.
| alert | The alert being queried. |
|
overridevirtual |
A callback function to notify an object that an alert has updated its state.
| alertInfo | The information of the updated alert. |
Implements alexaClientSDK::acsdkAlertsInterfaces::AlertObserverInterface.
| void alexaClientSDK::acsdkAlerts::AlertScheduler::onLocalStop | ( | ) |
Handle a local stop.
| bool alexaClientSDK::acsdkAlerts::AlertScheduler::reloadAlertsFromDatabase | ( | std::shared_ptr< settings::DeviceSettingsManager > | settingsManager, |
| bool | shouldScheduleAlerts | ||
| ) |
Reload alerts from database, then update expired alerts and set a timer for the next alert if desired. If there is an active alert, it will not interrupted or modified in any way.
| settingsManager | A settingsManager object used to load alerts. |
| shouldScheduleAlerts | Whether to start scheduling alerts. |
| bool alexaClientSDK::acsdkAlerts::AlertScheduler::saveOfflineStoppedAlert | ( | const std::string & | alertToken, |
| const std::string & | scheduledTime, | ||
| const std::string & | eventTime | ||
| ) |
Save the currently active alert as an offline stopped alert
| alertToken | the alert token of the offline stopped alert |
| scheduledTime | the scheduled time of the offline stopped alert |
| eventTime | the time the alert stopped |
| bool alexaClientSDK::acsdkAlerts::AlertScheduler::scheduleAlert | ( | std::shared_ptr< Alert > | alert | ) |
Schedule an alert for rendering.
| alert | The alert to be scheduled. |
| void alexaClientSDK::acsdkAlerts::AlertScheduler::shutdown | ( | ) |
Handle shutdown.
| bool alexaClientSDK::acsdkAlerts::AlertScheduler::snoozeAlert | ( | const std::string & | alertToken, |
| const std::string & | updatedTime_ISO_8601 | ||
| ) |
Snooze an active alert to re-activate at a new specified time. The alert, if active, will be de-activated and re-scheduled for the new time.
| alertToken | The AVS token identifying the alert. |
| updatedTime_ISO_8601 | The new time in ISO-8601 format. |
| void alexaClientSDK::acsdkAlerts::AlertScheduler::updateFocus | ( | avsCommon::avs::FocusState | focusState, |
| avsCommon::avs::MixingBehavior | behavior | ||
| ) |
Update our state of channel focus.
| focusState | The state we now have. |
| behavior | The mixing behavior. |
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0