AlexaClientSDK
1.19.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) | |
void | onAlertStateChange (const std::string &alertToken, const std::string &alertType, State state, const std::string &reason="") override |
bool | initialize (std::shared_ptr< AlertObserverInterface > observer, std::shared_ptr< settings::DeviceSettingsManager > settingsManager) |
bool | scheduleAlert (std::shared_ptr< Alert > alert) |
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) |
bool | isAlertActive (std::shared_ptr< Alert > alert) |
void | updateFocus (avsCommon::avs::FocusState focusState) |
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 () |
Public Member Functions inherited from alexaClientSDK::capabilityAgents::alerts::AlertObserverInterface | |
virtual | ~AlertObserverInterface ()=default |
Additional Inherited Members | |
Public Types inherited from alexaClientSDK::capabilityAgents::alerts::AlertObserverInterface | |
enum | State { State::READY, State::STARTED, State::STOPPED, State::SNOOZED, State::COMPLETED, State::PAST_DUE, State::FOCUS_ENTERED_FOREGROUND, State::FOCUS_ENTERED_BACKGROUND, State::ERROR, State::DELETED, State::SCHEDULED_FOR_LATER } |
Static Public Member Functions inherited from alexaClientSDK::capabilityAgents::alerts::AlertObserverInterface | |
static std::string | stateToString (State state) |
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::capabilityAgents::alerts::AlertScheduler::AlertScheduler | ( | std::shared_ptr< storage::AlertStorageInterface > | alertStorage, |
std::shared_ptr< renderer::RendererInterface > | alertRenderer, | ||
std::chrono::seconds | alertPastDueTimeLimitSeconds | ||
) |
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. |
void alexaClientSDK::capabilityAgents::alerts::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::capabilityAgents::alerts::AlertScheduler::deleteAlert | ( | const std::string & | alertToken | ) |
Delete an alert from the schedule.
alertToken | The AVS token identifying the alert. |
bool alexaClientSDK::capabilityAgents::alerts::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 |
std::list< std::shared_ptr< Alert > > alexaClientSDK::capabilityAgents::alerts::AlertScheduler::getAllAlerts | ( | ) |
Utility method to get list of all alerts being tracked by AlertScheduler
AlertScheduler
AlertScheduler::AlertsContextInfo alexaClientSDK::capabilityAgents::alerts::AlertScheduler::getContextInfo | ( | ) |
Collects Context data for all alerts being managed.
avsCommon::avs::FocusState alexaClientSDK::capabilityAgents::alerts::AlertScheduler::getFocusState | ( | ) |
Provide our current channel focus state.
bool alexaClientSDK::capabilityAgents::alerts::AlertScheduler::initialize | ( | std::shared_ptr< AlertObserverInterface > | observer, |
std::shared_ptr< settings::DeviceSettingsManager > | settingsManager | ||
) |
Initialization.
observer | An observer which we will notify of all alert state changes. |
m_settingsManager | A settingsManager object that manages alarm volume ramp setting. |
bool alexaClientSDK::capabilityAgents::alerts::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.
alertToken | The AVS token of the alert. |
alertType | The type of the alert. |
state | The state of the alert. |
reason | The reason for the state change. |
Implements alexaClientSDK::capabilityAgents::alerts::AlertObserverInterface.
void alexaClientSDK::capabilityAgents::alerts::AlertScheduler::onLocalStop | ( | ) |
Handle a local stop.
bool alexaClientSDK::capabilityAgents::alerts::AlertScheduler::scheduleAlert | ( | std::shared_ptr< Alert > | alert | ) |
Schedule an alert for rendering.
alert | The alert to be scheduled. |
void alexaClientSDK::capabilityAgents::alerts::AlertScheduler::shutdown | ( | ) |
Handle shutdown.
bool alexaClientSDK::capabilityAgents::alerts::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::capabilityAgents::alerts::AlertScheduler::updateFocus | ( | avsCommon::avs::FocusState | focusState | ) |
Update our state of channel focus.
focusState | The state we now have. |
AlexaClientSDK 1.19.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0